|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.das2.util.GrannyTextRenderer
public class GrannyTextRenderer
Renders Grandle and Nystrom strings, like "E=mc!e2"
Field Summary | |
---|---|
static int |
CENTER_ALIGNMENT
|
static int |
LEFT_ALIGNMENT
|
static int |
RIGHT_ALIGNMENT
|
Constructor Summary | |
---|---|
GrannyTextRenderer()
|
Method Summary | |
---|---|
void |
draw(java.awt.Graphics ig,
float ix,
float iy)
draw the current string. |
int |
getAlignment()
returns the current alignment, by default LEFT_ALIGNMENT. |
double |
getAscent()
return the amount that the bounding box will go above the baseline. |
java.awt.Rectangle |
getBounds()
returns the bounds of the current string. |
double |
getDescent()
return the amount that the bounding box will go below the baseline. |
double |
getHeight()
returns the hieght of the calculated bounding box. |
double |
getLineOneWidth()
returns the width in pixels of the first line. |
double |
getWidth()
returns the width of the bounding box, in pixels. |
void |
setAlignment(int a)
set the alignment for rendering, one of LEFT_ALIGNMENT CENTER_ALIGNMENT or RIGHT_ALIGNMENT. |
void |
setString(java.awt.Component c,
java.lang.String str)
Deprecated. use setString( Graphics g, String str ) instead. |
void |
setString(java.awt.Font font,
java.lang.String label)
reset the current string for the GTR to draw, calculating the boundaries of the string. |
void |
setString(java.awt.Graphics g,
java.lang.String str)
reset the current string for the GTR to draw, calculating the boundaries of the string. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int LEFT_ALIGNMENT
public static final int CENTER_ALIGNMENT
public static final int RIGHT_ALIGNMENT
Constructor Detail |
---|
public GrannyTextRenderer()
Method Detail |
---|
public java.awt.Rectangle getBounds()
java.lang.IllegalArgumentException
- if the string has not been set.public double getWidth()
java.lang.IllegalArgumentException
- if the string has not been set.public double getLineOneWidth()
java.lang.IllegalArgumentException
- if the string has not been set.public double getHeight()
java.lang.IllegalArgumentException
- if the string has not been set.public double getAscent()
java.lang.IllegalArgumentException
- if the string has not been set.public double getDescent()
java.lang.IllegalArgumentException
- if the string has not been set.public void setString(java.awt.Component c, java.lang.String str)
c
- the component which will provide the graphics.str
- the granny string, such as "E=mc!e2"public void setString(java.awt.Graphics g, java.lang.String str)
g
- the graphics context which will supply the FontMetrics.str
- the granny string, such as "E=mc!e2"public void setString(java.awt.Font font, java.lang.String label)
Font
- the font. This should be consistent
with the Font used when drawing.str
- the granny string, such as "E=mc!e2"public int getAlignment()
public void setAlignment(int a)
a
- the alignment, one of LEFT_ALIGNMENT CENTER_ALIGNMENT or RIGHT_ALIGNMENT.public void draw(java.awt.Graphics ig, float ix, float iy)
ig
- Graphic object to use to render the text.ix
- The x position of the first character of text.iy
- The y position of the baseline of the first line of text.public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |