java.awt
Class Font

java.lang.Object
  |
  +--java.awt.Font

public class Font
extends Object

A class that produces font objects.


Field Summary
static int BOLD
          The bold style constant.
static int ITALIC
          The italicized style constant.
protected  String name
          The logical name of this font.
static int PLAIN
          The plain style constant.
protected  int size
          The point size of this font.
protected  int style
          The style of the font.
 
Constructor Summary
Font(String name, int style, int size)
          Creates a new font with the specified name, style and point size.
 
Method Summary
 boolean equals(Object obj)
          Compares this object to the specifed object.
 String getFamily()
          Gets the platform specific family name of the font.
static Font getFont(String nm)
          Gets a font from the system properties list.
static Font getFont(String nm, Font font)
          Gets the specified font from the system properties list.
 String getName()
          Gets the logical name of the font.
 int getSize()
          Gets the point size of the font.
 int getStyle()
          Gets the style of the font.
 int hashCode()
          Returns a hashcode for this font.
 boolean isBold()
          Returns true if the font is bold.
 boolean isItalic()
          Returns true if the font is italic.
 boolean isPlain()
          Returns true if the font is plain.
 String toString()
          Converts this object to a String representation.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PLAIN

public static final int PLAIN
The plain style constant. This can be combined with the other style constants for mixed styles.

See Also:
Constant Field Values

BOLD

public static final int BOLD
The bold style constant. This can be combined with the other style constants for mixed styles.

See Also:
Constant Field Values

ITALIC

public static final int ITALIC
The italicized style constant. This can be combined with the other style constants for mixed styles.

See Also:
Constant Field Values

name

protected String name
The logical name of this font.


style

protected int style
The style of the font. This is the sum of the constants PLAIN, BOLD, or ITALIC.


size

protected int size
The point size of this font.

Constructor Detail

Font

public Font(String name,
            int style,
            int size)
Creates a new font with the specified name, style and point size.

Parameters:
name - the font name
style - the constant style used
size - the point size of the font
See Also:
Toolkit.getFontList()
Method Detail

getFamily

public String getFamily()
Gets the platform specific family name of the font. Use getName to get the logical name of the font.

See Also:
getName()

getName

public String getName()
Gets the logical name of the font.

See Also:
getFamily()

getStyle

public int getStyle()
Gets the style of the font.

See Also:
isPlain(), isBold(), isItalic()

getSize

public int getSize()
Gets the point size of the font.


isPlain

public boolean isPlain()
Returns true if the font is plain.

See Also:
getStyle()

isBold

public boolean isBold()
Returns true if the font is bold.

See Also:
getStyle()

isItalic

public boolean isItalic()
Returns true if the font is italic.

See Also:
getStyle()

getFont

public static Font getFont(String nm)
Gets a font from the system properties list.

Parameters:
nm - the property name

getFont

public static Font getFont(String nm,
                           Font font)
Gets the specified font from the system properties list.

Parameters:
nm - the property name
font - a default font to return if property 'nm' is not defined

hashCode

public int hashCode()
Returns a hashcode for this font.

Overrides:
hashCode in class Object
See Also:
Hashtable

equals

public boolean equals(Object obj)
Compares this object to the specifed object.

Overrides:
equals in class Object
Parameters:
obj - the object to compare with
Returns:
true if the objects are the same; false otherwise.
See Also:
Hashtable

toString

public String toString()
Converts this object to a String representation.

Overrides:
toString in class Object