Class java.awt.Font
All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.Font
Object
|
+----java.awt.Font
- public class Font
- extends Object
- implements Serializable
A class that produces font objects.
- Version:
- 1.29, 07/01/98
- Author:
- Sami Shaio, Arthur van Hoff, Jim Graham
- Since:
- JDK1.0
-
BOLD
- The bold style constant.
-
ITALIC
- The italicized style constant.
-
PLAIN
- The plain style constant.
-
name
-
The logical name of this font.
-
size
-
The point size of this font.
-
style
-
The style of the font.
-
java.awt.Font(String, int, int)
- Creates a new font with the specified name, style and point size.
-
decode(String)
- Gets the specified font using the name passed in.
-
equals(Object)
- Compares this object to the specifed object.
-
getFamily()
- Gets the platform specific family name of the font.
-
getFont(String)
- Gets a font from the system properties list.
-
getFont(String, Font)
- Gets the specified font from the system properties list.
-
getName()
- Gets the logical name of the font.
-
getPeer()
- Gets the peer of the font.
-
getSize()
- Gets the point size of the font.
-
getStyle()
- Gets the style of the font.
-
hashCode()
- Returns a hashcode for this font.
-
isBold()
- Indicates whether the font's style is bold.
-
isItalic()
- Indicates whether the font's style is italic.
-
isPlain()
- Indicates whether the font's style is plain.
-
toString()
-
Converts this object to a String representation.
BOLD
public static final int BOLD
- The bold style constant. This style can be combined with the
other style constants for mixed styles.
- Since:
JDK1.0
ITALIC
public static final int ITALIC
- The italicized style constant. This style can be combined
with the other style constants for mixed styles.
- Since:
JDK1.0
PLAIN
public static final int PLAIN
- The plain style constant. This style can be combined with
the other style constants for mixed styles.
- Since:
JDK1.0
name
protected java.lang.String name
- The logical name of this font.
- Since:
JDK1.0
size
protected int size
- The point size of this font.
- Since:
JDK1.0
style
protected int style
- The style of the font. This is the sum of the
constants
PLAIN
, BOLD
,
or ITALIC
.
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
- Since:
- JDK1.0
- See Also:
- getFontList
decode
public static java.awt.Font decode(String str)
- Gets the specified font using the name passed in.
- Parameters:
- str - the name
- Since:
- JDK1.1
equals
public boolean equals(Object obj)
- Compares this object to the specifed object.
The result is
true
if and only if the argument is not
null
and is a Font
object with the same
name, style, and point size as this font.
- Parameters:
- obj - the object to compare this font with.
- Returns:
-
true
if the objects are equal;
false
otherwise.
- Overrides:
- equals in class Object
- Since:
- JDK1.0
getFamily
public java.lang.String getFamily()
- Gets the platform specific family name of the font. Use the
getName
method to get the logical name of the font.
- Returns:
- a string, the platform specific family name.
- Since:
- JDK1.0
- See Also:
- getName
getFont
public static java.awt.Font getFont(String nm)
- Gets a font from the system properties list.
- Parameters:
- nm - the property name
- Since:
- JDK1.0
- See Also:
- getFont(java.lang.String, java.awt.Font)
getFont
public static java.awt.Font getFont(String nm,
Font font)
- Gets the specified font from the system properties list.
The first argument is treated as the name of a system property to
be obtained as if by the method
System.getProperty
.
The string value of this property is then interpreted as a font.
The property value should be one of the following forms:
- fontname-style-pointsize
- fontname-pointsize
- fontname-style
- fontname
where style is one of the three strings
"BOLD"
, "BOLDITALIC"
, or
"ITALIC"
, and point size is a decimal
representation of the point size.
The default style is PLAIN
. The default point size
is 12.
If the specified property is not found, the font
argument is returned instead.
- Parameters:
- nm - the property name
- font - a default font to return if property
nm
is not defined
- Returns:
- the
Font
value of the property.
- Since:
- JDK1.0
getName
public java.lang.String getName()
- Gets the logical name of the font.
- Returns:
- a string, the logical name of the font.
- Since:
- JDK1.0
- See Also:
- getFamily
getPeer
public java.awt.peer.FontPeer getPeer()
- Gets the peer of the font.
- Returns:
- the peer of the font.
- Since:
- JDK1.1
getSize
public int getSize()
- Gets the point size of the font.
- Returns:
- the point size of this font.
- Since:
- JDK1.0
getStyle
public int getStyle()
- Gets the style of the font.
- Returns:
- the style of this font.
- Since:
- JDK1.0
- See Also:
- isPlain, isBold, isItalic
hashCode
public int hashCode()
- Returns a hashcode for this font.
- Returns:
- a hashcode value for this font.
- Overrides:
- hashCode in class Object
- Since:
- JDK1.0
isBold
public boolean isBold()
- Indicates whether the font's style is bold.
- Returns:
-
true
if the font is bold;
false
otherwise.
- Since:
- JDK1.0
- See Also:
- getStyle
isItalic
public boolean isItalic()
- Indicates whether the font's style is italic.
- Returns:
-
true
if the font is italic;
false
otherwise.
- Since:
- JDK1.0
- See Also:
- getStyle
isPlain
public boolean isPlain()
- Indicates whether the font's style is plain.
- Returns:
-
true
if the font is neither
bold nor italic; false
otherwise.
- Since:
- JDK1.0
- See Also:
- getStyle
toString
public java.lang.String toString()
- Converts this object to a String representation.
- Returns:
- a string representation of this object
- Overrides:
- toString in class Object
- Since:
- JDK1.0
All Packages Class Hierarchy This Package Previous Next Index