waba.fx
Class Font
waba.lang.Object
|
+--waba.fx.Font
- public class Font
- extends Object
Font is the character font used when drawing text on a surface.
Fonts have a name, such as "Helvetica", a style and a point size (usually
around 10). It's important to note that many devices have an extremely
limited number of fonts. For example, most PalmPilot devices have only
two fonts: plain and bold. If the font specified can't be found during
drawing, the closest matching font will be used.
Here is an example showing text being drawn in a given font:
...
Font font = new Font("Helvetica", Font.BOLD, 10);
}
public void onPaint(Graphics g)
{
g.setFont(font);
g.drawText("Hello", 10, 10);
...
Field Summary |
static int |
BOLD
A bold font style. |
static int |
PLAIN
A plain font style. |
Constructor Summary |
Font(String name,
int style,
int size)
Creates a font of the given name, style and size. |
Method Summary |
String |
getName()
Returns the name of the font. |
int |
getSize()
Returns the size of the font. |
int |
getStyle()
Returns the style of the font. |
PLAIN
public static final int PLAIN
- A plain font style.
BOLD
public static final int BOLD
- A bold font style.
Font
public Font(String name,
int style,
int size)
- Creates a font of the given name, style and size. Font styles are defined
in this class.
- See Also:
PLAIN
,
BOLD
,
Graphics
getName
public String getName()
- Returns the name of the font.
getSize
public int getSize()
- Returns the size of the font.
getStyle
public int getStyle()
- Returns the style of the font. Font styles are defined in this class.
- See Also:
PLAIN
,
BOLD