waba.fx
Class Font

java.lang.Object
  |
  +--waba.fx.Font

public class Font
extends java.lang.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(java.lang.String name, int style, int size)
          Creates a font of the given name, style and size.
 
Method Summary
 java.lang.String getName()
          Returns the name of the font.
 int getSize()
          Returns the size of the font.
 int getStyle()
          Returns the style of the font.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLAIN

public static final int PLAIN
A plain font style.

BOLD

public static final int BOLD
A bold font style.
Constructor Detail

Font

public Font(java.lang.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
Method Detail

getName

public java.lang.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