- java.lang.Object
-
- org.jfree.chart.text.TextLine
-
- All Implemented Interfaces:
Serializable
public class TextLine extends Object implements Serializable
A sequence ofTextFragmentobjects that together form a line of text. A sequence of text lines is managed by theTextBlockclass.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFragment(TextFragment fragment)Adds a text fragment to the text line.org.jfree.chart.block.Size2DcalculateDimensions(Graphics2D g2)Calculates the width and height of the text line.voiddraw(Graphics2D g2, float anchorX, float anchorY, TextAnchor anchor, float rotateX, float rotateY, double angle)Draws the text line.booleanequals(Object obj)Tests this object for equality with an arbitrary object.TextFragmentgetFirstTextFragment()Returns the first text fragment in the line.TextFragmentgetLastTextFragment()Returns the last text fragment in the line.inthashCode()Returns a hash code for this object.voidremoveFragment(TextFragment fragment)Removes a fragment from the line.
-
-
-
Constructor Detail
-
TextLine
public TextLine()
Creates a new empty line.
-
TextLine
public TextLine(String text)
Creates a new text line using the default font.- Parameters:
text- the text (nullnot permitted).
-
TextLine
public TextLine(String text, Font font)
Creates a new text line.- Parameters:
text- the text (nullnot permitted).font- the text font (nullnot permitted).
-
-
Method Detail
-
addFragment
public void addFragment(TextFragment fragment)
Adds a text fragment to the text line.- Parameters:
fragment- the text fragment (nullnot permitted).
-
removeFragment
public void removeFragment(TextFragment fragment)
Removes a fragment from the line.- Parameters:
fragment- the fragment to remove.
-
draw
public void draw(Graphics2D g2, float anchorX, float anchorY, TextAnchor anchor, float rotateX, float rotateY, double angle)
Draws the text line.- Parameters:
g2- the graphics device.anchorX- the x-coordinate for the anchor point.anchorY- the y-coordinate for the anchor point.anchor- the point on the text line that is aligned to the anchor point.rotateX- the x-coordinate for the rotation point.rotateY- the y-coordinate for the rotation point.angle- the rotation angle (in radians).
-
calculateDimensions
public org.jfree.chart.block.Size2D calculateDimensions(Graphics2D g2)
Calculates the width and height of the text line.- Parameters:
g2- the graphics device.- Returns:
- The width and height.
-
getFirstTextFragment
public TextFragment getFirstTextFragment()
Returns the first text fragment in the line.- Returns:
- The first text fragment in the line.
-
getLastTextFragment
public TextFragment getLastTextFragment()
Returns the last text fragment in the line.- Returns:
- The last text fragment in the line.
-
-