org.jCharts.chartText
public class TextTag extends Object implements HTMLTestable, Serializable
Modifier and Type | Field and Description |
---|---|
private Hashtable |
attributes |
private Font |
derivedFont |
private Font |
font |
private float |
fontAscent |
private float |
fontDescent |
private float |
height |
private boolean |
isDerived |
private boolean |
isHidden |
private String |
text |
private TextLayout |
textLayout |
private float |
width |
private float |
xPosition |
private float |
yPosition |
Constructor and Description |
---|
TextTag(String text,
Font baseFont,
Font derivedFont,
FontRenderContext fontRenderContext)
Constructor when using transformed (derived) fonts
The need for this arises because the java metrics classes return either 0 or very strange
values for the width and height of a string (TextLayout, LineMetrics, etc..) when
the font is derived
|
TextTag(String text,
Font baseFont,
FontRenderContext fontRenderContext)
Default constructor - for untransformed fonts.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(String name,
Object o) |
Object |
getAttribute(String name) |
float |
getBottomSide() |
float |
getFontAscent() |
float |
getFontDescent() |
float |
getHeight() |
boolean |
getHidden() |
Rectangle2D.Float |
getRectangle() |
float |
getRightSide() |
String |
getText() |
float |
getWidth() |
float |
getXPosition() |
float |
getYPosition() |
void |
render(Graphics2D g2d,
float x,
float y)
Renders the text, at the position - renders from the top (instead of baseline)
|
void |
render(Graphics2D g2d,
Paint fontColor)
Renders the text, at the position - renders from the top (instead of baseline)
|
void |
setHidden(boolean b) |
void |
setPosition(float x,
float y) |
void |
setXPosition(float x) |
void |
setYPosition(float y) |
void |
toHTML(HTMLGenerator htmlGenerator)
Enables the testing routines to display the contents of this Object.
|
String |
toString() |
private float xPosition
private float yPosition
private TextLayout textLayout
private Hashtable attributes
private boolean isHidden
private float width
private float height
private float fontAscent
private float fontDescent
private boolean isDerived
private Font derivedFont
private String text
private Font font
public TextTag(String text, Font baseFont, FontRenderContext fontRenderContext)
public TextTag(String text, Font baseFont, Font derivedFont, FontRenderContext fontRenderContext)
text
- baseFont
- is the original (untransformed) font.derivedFont
- is the transformed fontfontRenderContext
- public float getWidth()
public float getHeight()
public float getFontAscent()
public float getFontDescent()
public void setPosition(float x, float y)
public void setXPosition(float x)
public void setYPosition(float y)
public float getXPosition()
public float getYPosition()
public float getRightSide()
public float getBottomSide()
public Rectangle2D.Float getRectangle()
public void setHidden(boolean b)
public boolean getHidden()
public String getText()
public void render(Graphics2D g2d, Paint fontColor)
g2d
- fontColor
- public void render(Graphics2D g2d, float x, float y)
g2d
- public void toHTML(HTMLGenerator htmlGenerator)
toHTML
in interface HTMLTestable
htmlGenerator
-