An object of the Font class is used to specify the basic appearance, the style, and the size of text that is displayed on the user interface. Different components can use different fonts.
Font(String name, int style, int size)
The following font names should be valid on any system capable of running Java. However, these font names may not, in fact, refer to different fonts on a given platform. Since the parameter is a literal string, the quotation marks are required.
The font style can be any of the following integer constants in the Font class. The last font style indicates a font that is both bold and italic.
The font size is an integer value representing the point size of the font. There are 72 points per inch.
The following line of Java code creates a new Font object representing a bold-faced, 12-point, sans serif font:
Font fontSansSerif = new Font("SansSerif", Font.BOLD, 12);