|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--waba.fx.Font
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 = Font.getFont("Tiny", true, Font.NORMAL_SIZE);
edName.setFont(font);
public void onPaint(Graphics g)
{
g.setFont(font);
g.drawText("Hello", 10, 10);
...
SuperWaba notes:
g.setFont(new Font("myFont", Font.PLAIN or Font.BOLD,12 or 14)).
myLabel.setFont(new Font("SystemNarrow",Font.PLAIN,12));
In this case, the style and size parameters are not used.
| Field Summary | |
static int |
BIG_SIZE
A normal-sized font |
static int |
BOLD
Deprecated. The style parameter is now a boolean. |
static java.lang.String |
DEFAULT
The default font name: "SW". |
FontMetrics |
fm
|
java.lang.String |
name
Read only field that contains the font's name. |
static int |
NORMAL_SIZE
A big-sized font |
static int |
PLAIN
Deprecated. The style parameter is now a boolean. |
int |
size
Read only field that contains the font's size. |
int |
style
Read only field that contains the font's style. |
| Constructor Summary | |
Font(java.lang.String name,
int style,
int size)
Deprecated. This class is now a singleton. Please use the Font.getFont method instead. |
|
| Method Summary | |
Font |
asBold()
Returns this font as Bold |
static Font |
getFont(java.lang.String name,
boolean boldStyle,
int size)
Gets the instance of a font of the given name, style and size. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public java.lang.String name
public int style
PLAIN,
BOLDpublic int size
public FontMetrics fm
public static final int PLAIN
public static final int BOLD
public static final int BIG_SIZE
public static final int NORMAL_SIZE
public static final java.lang.String DEFAULT
| Constructor Detail |
public Font(java.lang.String name,
int style,
int size)
Font.getFont method instead.
name - Use DEFAULT to use the default font ("SW"). You must install other fonts if you want to use them.style - Font.PLAIN or Font.BOLDsize - If font size is >= 14, it uses the large font set; otherwise, if < 14, it uses the normal font set.PLAIN,
BOLD| Method Detail |
public static Font getFont(java.lang.String name,
boolean boldStyle,
int size)
name - "SW" is the default font. You must install other fonts if you want to use them.boldStyle - If true, a bold font is used. Otherwise, a plain font is used.size - If font size is >= 14, it uses the large font set; otherwise, if < 14, it uses the normal font set. You can also use Font.BIG_SIZE and Font.NORMAL_SIZE.PLAIN,
BOLDpublic Font asBold()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||