|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectview.AbstractFilledShape
view.TextDraw
public class TextDraw
Drawing text in shapes is not recomended as the text size will change
due to component size changes. Thus we provide here a basic class that
combines all relevant information on drawing text to a shape canvas.
Instances of this class can be added to the shape canvas by calls to
JNormalizedCanvas#addText.
| Field Summary | |
|---|---|
private boolean |
filled
If only the outline of the text should be drawn, this is false. |
private Font |
font
The font to use for rendering. |
private float |
horjust
The horizontal justification. |
private Point2D |
offset
We need extra offset, as we never scale the string. |
private Point2D |
position
The position of the text in a 0,0, 1x1 drawing area. |
private double |
rotation
A rotational angle. |
private String |
text
The text to draw. |
private float |
vertjust
The vertical justification. |
| Constructor Summary | |
|---|---|
TextDraw(String note,
Font render,
Point2D where)
Constructs a text-draw object additionally specifying a font. |
|
TextDraw(String note,
Font render,
Point2D where,
float vjus,
float hjus,
double rot)
Constructs a rotated text-draw object with given justifications, but no extra offset. |
|
TextDraw(String note,
Font render,
Point2D where,
Point2D extra,
float vjus,
float hjus,
double rot)
Constructs a full text-draw object. |
|
TextDraw(String note,
Font render,
Point2D where,
Point2D extra,
float vjus,
float hjus,
double rot,
boolean fill)
Constructs a full text-draw object. |
|
TextDraw(String note,
Point2D where)
Construct a text draw object with the minimal information. |
|
TextDraw(String note,
Point2D where,
float vjus,
float hjus)
Constructs a text-draw object with given justifications. |
|
| Method Summary | |
|---|---|
boolean |
equals(Object that)
Equal, if equal position, string rotation, font etc. |
Rectangle2D |
getBounds2D(Component c)
Returns the bounding rectangle of this text draw object in screen coordinates, if positioned at zero,zero in the given component. |
Rectangle2D |
getBounds2D(Font def,
FontRenderContext frt)
Returns the bounding rectangle of this text draw object in screen coordinates, if positioned at zero,zero. |
Rectangle2D |
getBounds2D(GlyphVector gv)
Returns the bounding rectangle of this text draw object in screen coordinates, if positioned at zero,zero. |
Point2D |
getCenter()
Simplified center. |
Font |
getFont()
Returns the font used to render this string. |
GlyphVector |
getGlyphVector(Font def,
FontRenderContext frt)
Returns the glyph vector to the text draw object. |
float |
getHorizontalJustification()
Returns the horizontal justification. |
Point2D |
getOffset()
Returns the absolute offset of the text in pixel coordinates. |
Point2D |
getPosition()
Returns the position of the text in a 0,0 1x1 frame. |
Shape |
getRotated(GlyphVector gv)
Transforms the glyph vector to a rotated instance. |
double |
getRotation()
Returns the rotation angle. |
Shape |
getShape(Graphics2D g2d)
Returns the zero-centered shape. |
String |
getText()
Returns the text to draw. |
float |
getVerticalJustification()
Returns the vertical justification. |
int |
hashCode()
Hash code is the has code of the location. |
boolean |
isFilled()
Returns the true, if text should be painted as filled (default). |
boolean |
isRotate()
Returns true, if the text has to be transformed. |
| Methods inherited from class view.AbstractFilledShape |
|---|
getUnique |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private String text
private Font font
private Point2D position
private Point2D offset
private float vertjust
private float horjust
private double rotation
private boolean filled
| Constructor Detail |
|---|
public TextDraw(String note,
Point2D where)
public TextDraw(String note,
Font render,
Point2D where)
public TextDraw(String note,
Point2D where,
float vjus,
float hjus)
public TextDraw(String note,
Font render,
Point2D where,
float vjus,
float hjus,
double rot)
public TextDraw(String note,
Font render,
Point2D where,
Point2D extra,
float vjus,
float hjus,
double rot)
public TextDraw(String note,
Font render,
Point2D where,
Point2D extra,
float vjus,
float hjus,
double rot,
boolean fill)
| Method Detail |
|---|
public String getText()
public Font getFont()
public Point2D getPosition()
public Point2D getOffset()
public float getHorizontalJustification()
public float getVerticalJustification()
public double getRotation()
public GlyphVector getGlyphVector(Font def,
FontRenderContext frt)
public boolean isRotate()
public Rectangle2D getBounds2D(Component c)
public Rectangle2D getBounds2D(Font def,
FontRenderContext frt)
public Rectangle2D getBounds2D(GlyphVector gv)
public Shape getRotated(GlyphVector gv)
public boolean isFilled()
isFilled in interface FilledShapepublic Shape getShape(Graphics2D g2d)
getShape in interface FilledShapepublic Point2D getCenter()
getCenter in interface Centerablepublic int hashCode()
hashCode in class AbstractFilledShapepublic boolean equals(Object that)
equals in class AbstractFilledShape
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||