Package org.jCharts.chartText
Class TextTag
java.lang.Object
org.jCharts.chartText.TextTag
- All Implemented Interfaces:
Serializable,HTMLTestable
- Direct Known Subclasses:
BarValueGroup.BarValue
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Hashtableprivate Fontprivate Fontprivate floatprivate floatprivate floatprivate booleanprivate booleanprivate Stringprivate TextLayoutprivate floatprivate floatprivate float -
Constructor Summary
ConstructorsConstructorDescriptionTextTag(String text, Font baseFont, FontRenderContext fontRenderContext) Default constructor - for untransformed fonts.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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(String name, Object o) getAttribute(String name) floatfloatfloatfloatbooleanfloatgetText()floatgetWidth()floatfloatvoidrender(Graphics2D g2d, float x, float y) Renders the text, at the position - renders from the top (instead of baseline)voidrender(Graphics2D g2d, Paint fontColor) Renders the text, at the position - renders from the top (instead of baseline)voidsetHidden(boolean b) voidsetPosition(float x, float y) voidsetXPosition(float x) voidsetYPosition(float y) voidtoHTML(HTMLGenerator htmlGenerator) Enables the testing routines to display the contents of this Object.toString()
-
Field Details
-
xPosition
private float xPosition -
yPosition
private float yPosition -
textLayout
-
attributes
-
isHidden
private boolean isHidden -
width
private float width -
height
private float height -
fontAscent
private float fontAscent -
fontDescent
private float fontDescent -
isDerived
private boolean isDerived -
derivedFont
-
text
-
font
-
-
Constructor Details
-
TextTag
Default constructor - for untransformed fonts. -
TextTag
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- Parameters:
text-baseFont- is the original (untransformed) font.derivedFont- is the transformed fontfontRenderContext-
-
-
Method Details
-
getWidth
public float getWidth() -
getHeight
public float getHeight() -
getFontAscent
public float getFontAscent() -
getFontDescent
public float getFontDescent() -
setPosition
public void setPosition(float x, float y) -
setXPosition
public void setXPosition(float x) -
setYPosition
public void setYPosition(float y) -
getXPosition
public float getXPosition() -
getYPosition
public float getYPosition() -
getRightSide
public float getRightSide() -
getBottomSide
public float getBottomSide() -
getRectangle
-
setHidden
public void setHidden(boolean b) -
getHidden
public boolean getHidden() -
getText
-
addAttribute
-
getAttribute
-
render
Renders the text, at the position - renders from the top (instead of baseline)- Parameters:
g2d-fontColor-
-
render
Renders the text, at the position - renders from the top (instead of baseline)- Parameters:
g2d-
-
toHTML
Enables the testing routines to display the contents of this Object.- Specified by:
toHTMLin interfaceHTMLTestable- Parameters:
htmlGenerator-
-
toString
-