Font
The Font class is used to display character data in a gui application.
This does not work with the debug window (console). You can set the font of
buttons, labels, etc. You can also set the font for drawing text if you override
the paint or paintComponent methods. You must import java.awt.Font;
Examples:
Font font = new Font("Courier New",Font.BOLD,16);
JButton button = new JButton("What Font?");
button.setFont(font);
Font font = new Font("monospaced",Font.PLAIN,16);
button.setFont(font);
There are many Font names that can be used. If the font is not available, Java will choose the closest font that is available.
serif
sansserif
monospaced
etc.
Font Constants:
Font.BOLD
Font.PLAIN
Font.ITALIC
Font Links:
More Info
Centering Text in Graphics
More Info
Java Docs