| java.lang.Object java.awt.Font
All known Subclasses: sun.awt.qt.QtFont,
Font | public class Font implements java.io.Serializable(Code) | | A class that produces font objects.
version: 1.6, 08/19/02 author: Nicholas Allen since: JDK1.0 |
Field Summary | |
final public static int | BOLD The bold style constant. | final public static int | ITALIC The italicized style constant. | final public static int | PLAIN The plain style constant. | protected String | name The logical name of this font. | protected int | size The point size of this font. | protected int | style The style of the font. |
Constructor Summary | |
public | Font(String name, int style, int size) Creates a new font with the specified name, style and point size. |
Method Summary | |
public static Font | decode(String str) Gets the specified font using the name passed in. | 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. | public String | getFamily() Gets the platform specific family name of the font. | public static Font | getFont(String nm) Gets a font from the system properties list. | public static 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 . | public String | getName() Gets the logical name of the font. | public int | getSize() Gets the point size of the font. | public int | getStyle() Gets the style of the font. | X11FontMetrics | getX11FontMetrics() | public int | hashCode() Returns a hashcode for this font. | public boolean | isBold() Indicates whether the font's style is bold. | public boolean | isItalic() Indicates whether the font's style is italic. | public boolean | isPlain() Indicates whether the font's style is plain. | public String | toString() Converts this object to a String representation. |
BOLD | final public static int BOLD(Code) | | The bold style constant. This style can be combined with the
other style constants for mixed styles.
since: JDK1.0 |
ITALIC | final public static int ITALIC(Code) | | The italicized style constant. This style can be combined
with the other style constants for mixed styles.
since: JDK1.0 |
PLAIN | final public static int PLAIN(Code) | | The plain style constant. This style can be combined with
the other style constants for mixed styles.
since: JDK1.0 |
name | protected String name(Code) | | The logical name of this font.
since: JDK1.0 |
size | protected int size(Code) | | The point size of this font.
since: JDK1.0 |
style | protected int style(Code) | | 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)(Code) | | Creates a new font with the specified name, style and point size.
Parameters: name - the font name Parameters: style - the constant style used Parameters: size - the point size of the font See Also: Toolkit.getFontList since: JDK1.0 |
decode | public static Font decode(String str)(Code) | | Gets the specified font using the name passed in.
Parameters: str - the name since: JDK1.1 |
equals | public boolean equals(Object obj)(Code) | | 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. true if the objects are equal;false otherwise. since: JDK1.0 |
getFamily | public String getFamily()(Code) | | Gets the platform specific family name of the font. Use the
getName method to get the logical name of the font.
a string, the platform specific family name. See Also: java.awt.Font.getName since: JDK1.0 |
getFont | public static Font getFont(String nm, Font font)(Code) | | 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 Parameters: font - a default font to return if property nm is not defined the Font value of the property. since: JDK1.0 |
getName | public String getName()(Code) | | Gets the logical name of the font.
a string, the logical name of the font. See Also: Font.getFamily since: JDK1.0 |
getSize | public int getSize()(Code) | | Gets the point size of the font.
the point size of this font. since: JDK1.0 |
hashCode | public int hashCode()(Code) | | Returns a hashcode for this font.
a hashcode value for this font. since: JDK1.0 |
isBold | public boolean isBold()(Code) | | Indicates whether the font's style is bold.
true if the font is bold;false otherwise. See Also: java.awt.Font.getStyle since: JDK1.0 |
isItalic | public boolean isItalic()(Code) | | Indicates whether the font's style is italic.
true if the font is italic;false otherwise. See Also: java.awt.Font.getStyle since: JDK1.0 |
isPlain | public boolean isPlain()(Code) | | Indicates whether the font's style is plain.
true if the font is neitherbold nor italic; false otherwise. See Also: java.awt.Font.getStyle since: JDK1.0 |
toString | public String toString()(Code) | | Converts this object to a String representation.
a string representation of this object since: JDK1.0 |
|
|