Showing posts with label ITALIC. Show all posts
Showing posts with label ITALIC. Show all posts

Thursday, 27 February 2014

METHODS FOR FONTS IN GRAPHICS CLASS

WORKING WITH FONTS

Font Class in java applet with sample program..........

The AWT supports multiple type fonts. Within AWT, a font is specified by its name, style, and size. Each platform that supports Java provides a basic set of fonts. Beginning with Java 2, fonts have a family name, a logical font name, and a face name. The family name is the general name of the font, such as Courier. The logical name specifies a category of font, such as Monospaced. The face name specifies a specific font, such as Courier Italic.
An instance of the Font class represents a specific font to the system.

The Font class defines these variables:-


 Variable                     Meaning


 protected String name                    Name of the font
 protected int size                              Size of the font in points
 protected int style                            Font style


There are four styles for displaying fonts in Java: plain, bold, italic, and bold italic. Three class constants are used to represent font styles:

public static final int BOLD:The BOLD constant represents a boldface font.

public static final int ITALIC:The ITALIC constant represents an italic font.

public static final int PLAIN:The PLAIN constant represents a plain or normal font.

The combination BOLD/ITALIC represents a bold italic font. PLAIN combined with either BOLD or ITALIC represents bold or italic, respectively.