The javax.swing.JComponent.setFont method is used to set fonts for text associated with a component. This method requires a font object as a parameter; the font object itself is created by using the java.awt.Font(font_name, font_style, font_size) constructor. For example,
cartbutton.setFont(new Font(''Italic", Font.ITALIC, 12));
sets the font associated with the JButton object cartbutton to 12 point italic. If cartbutton is a labeled button, then any text inside the button will use this font.
How to set Fonts in Java
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment