Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Different Fonts

  Asked By: Leona    Date: Mar 29    Category: Java    Views: 919
  

can any body tell me how to textArea with different
Font size,colors etc. how to save them and retrive them.

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Gustavo Taylor     Answered On: Mar 29

This is an applet of Diferent Fonts, and colors:

/**
* @(#)FontColor.java 1.0 03/09/15
*
* Felipe Chaves Santos - Digital Solutions
*
*/
import java.applet.*;
import java.awt.*;
public class FontColor extends Applet {

Font f1 = new Font("Helvetica", Font.PLAIN, 18);
Font f2 = new Font("Helvica", Font.BOLD, 10);
Font f3 = new Font("Helvica", Font.ITALIC, 12);
Font f4 = new Font("Currier", Font.PLAIN, 12);
Font f5 = new Font("TimesRoman", Font.BOLD + Font.ITALIC, 14);
Font f6 = new Font("Dialog", Font.ITALIC, 14);

public void paint(Graphics g) {
g.setFont(f1);
g.setColor(Color.blue);
g.drawString("18pt plain Helvetica", 5, 20);

g.setFont(f2);
g.setColor(Color.red);
g.drawString("10pt bold Helvetica", 5, 43);

g.setFont(f3);
g.setColor(Color.black);
g.drawString("12pt italic Helvetica", 5, 58);

g.setFont(f4);
g.setColor(Color.green);
g.drawString("12pt plain Courier", 5, 75);

g.setFont(f5);
g.setColor(Color.lightGray);
g.drawString("14pt bold & italic Times Roman", 5, 92);

g.setFont(f6);
g.setColor(Color.magenta);
g.drawString("14pt italic Dialog", 5, 111);
}
}

 
Answer #2    Answered By: Velma Adams     Answered On: Mar 29

Will this work for custom fonts? Anything I might download off the
internet? I've had a problem with Java only letting me do the base
selection of fonts, and not evrything I might have installed in addition
to the base fonts.

 
Didn't find what you were looking for? Find more on Different Fonts Or get search suggestion and latest updates.




Tagged: