
 |
Chapter 19 java.awt Reference |
 |
Font
Name
Font
The Font class represents a
specific font to the system.
public class java.awt.Font
extends java.lang.Object
implements java.io.Serializable {
// Constants
public static final int BOLD;
public static final int ITALIC;
public static final int PLAIN;
// Variables
protected String name;
protected int size;
protected int style;
// Constructors
public Font (String name, int style, int size);
// Class Methods
public static Font decode (String str);
public static Font getFont (String name)
public static Font getFont (String name, Font defaultFont)
// Instance Methods
public boolean equals (Object object);
public String getFamily();
public String getName();
public FontPeer getPeer();
public int getSize();
public int getStyle();
public int hashCode();
public boolean isBold();
public boolean isItalic();
public boolean isPlain();
public String toString();
}
Constant for specifying bold fonts.
Constant for specifying fonts.
Constant for specifying plain fonts.
The font size; allegedly in points, though probably not true typographer's
points.
The font style, e.g., bold or italic or a combination thereof.
- Parameters
-
- name
-
The name of the desired font.
- style
-
One of the style flags (PLAIN,
BOLD, or ITALIC)
or a combination.
- size
-
The size of the font to create.
- Description
-
Constructs a Font object with
the given characteristics.
- Parameters
-
- str
-
The string describing
the font.
- Returns
-
Font instance requested, or
default if str is invalid.
- Description
-
Gets font specified by str.
- Parameters
-
- name
-
The name of a system
property specifying a font to fetch.
- Returns
-
Font instance for name requested,
or null if name is invalid.
- Description
-
Gets font specified by the system property name.
- Parameters
-
- name
-
The name of a system
property specifying a font to fetch.
- defaultFont
-
Font to return
if name not found in properties.
- Returns
-
Font instance of name requested,
or defaultFont if name
is invalid
- Description
-
Gets font specified by the system property name.
- Parameters
-
- object
-
The object to compare.
- Returns
-
true if the objects are equivalent
fonts (same name, style, and point size), false
otherwise.
- Overrides
-
Object.equals(Object)
- Description
-
Compares two different Font
instances for equivalence.
- Returns
-
Retrieves the actual name of the font.
- Returns
-
Retrieves the logical name of the font.
- Returns
-
Retrieves the size parameter from creation
- Returns
-
Retrieves the style parameter from creation.
- Returns
-
A hashcode to use when using the Font
as a key in a Hashtable.
- Overrides
-
Object.hashCode()
- Description
-
Generates a hashcode for the Font.
- Returns
-
true if Font style
is bold, false otherwise.
- Returns
-
true if Font style
is italic, false otherwise.
- Returns
-
true if Font style
is neither bold nor italic, false
otherwise.
- Returns
-
A string representation of the Font
object.
- Overrides
-
Object.toString()
FontMetrics, Object,
Properties, String
|
|