Package org.jCharts.chartText
Class TextTag
- java.lang.Object
-
- org.jCharts.chartText.TextTag
-
- All Implemented Interfaces:
java.io.Serializable,HTMLTestable
- Direct Known Subclasses:
BarValueGroup.BarValue
public class TextTag extends java.lang.Object implements HTMLTestable, java.io.Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Hashtableattributesprivate java.awt.FontderivedFontprivate java.awt.Fontfontprivate floatfontAscentprivate floatfontDescentprivate floatheightprivate booleanisDerivedprivate booleanisHiddenprivate java.lang.Stringtextprivate java.awt.font.TextLayouttextLayoutprivate floatwidthprivate floatxPositionprivate floatyPosition
-
Constructor Summary
Constructors Constructor Description TextTag(java.lang.String text, java.awt.Font baseFont, java.awt.font.FontRenderContext fontRenderContext)Default constructor - for untransformed fonts.TextTag(java.lang.String text, java.awt.Font baseFont, java.awt.Font derivedFont, java.awt.font.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(java.lang.String name, java.lang.Object o)java.lang.ObjectgetAttribute(java.lang.String name)floatgetBottomSide()floatgetFontAscent()floatgetFontDescent()floatgetHeight()booleangetHidden()java.awt.geom.Rectangle2D.FloatgetRectangle()floatgetRightSide()java.lang.StringgetText()floatgetWidth()floatgetXPosition()floatgetYPosition()voidrender(java.awt.Graphics2D g2d, float x, float y)Renders the text, at the position - renders from the top (instead of baseline)voidrender(java.awt.Graphics2D g2d, java.awt.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.java.lang.StringtoString()
-
-
-
Field Detail
-
xPosition
private float xPosition
-
yPosition
private float yPosition
-
textLayout
private java.awt.font.TextLayout textLayout
-
attributes
private java.util.Hashtable 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
private java.awt.Font derivedFont
-
text
private java.lang.String text
-
font
private java.awt.Font font
-
-
Constructor Detail
-
TextTag
public TextTag(java.lang.String text, java.awt.Font baseFont, java.awt.font.FontRenderContext fontRenderContext)Default constructor - for untransformed fonts.
-
TextTag
public TextTag(java.lang.String text, java.awt.Font baseFont, java.awt.Font derivedFont, java.awt.font.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- Parameters:
text-baseFont- is the original (untransformed) font.derivedFont- is the transformed fontfontRenderContext-
-
-
Method Detail
-
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
public java.awt.geom.Rectangle2D.Float getRectangle()
-
setHidden
public void setHidden(boolean b)
-
getHidden
public boolean getHidden()
-
getText
public java.lang.String getText()
-
addAttribute
public void addAttribute(java.lang.String name, java.lang.Object o)
-
getAttribute
public java.lang.Object getAttribute(java.lang.String name)
-
render
public void render(java.awt.Graphics2D g2d, java.awt.Paint fontColor)Renders the text, at the position - renders from the top (instead of baseline)- Parameters:
g2d-fontColor-
-
render
public void render(java.awt.Graphics2D g2d, float x, float y)Renders the text, at the position - renders from the top (instead of baseline)- Parameters:
g2d-
-
toHTML
public void toHTML(HTMLGenerator htmlGenerator)
Enables the testing routines to display the contents of this Object.- Specified by:
toHTMLin interfaceHTMLTestable- Parameters:
htmlGenerator-
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Returns:
-
-