public class TextLine extends Object implements Serializable
TextFragment
objects that together form a line of
text. A sequence of text lines is managed by the TextBlock
class.Constructor and Description |
---|
TextLine()
Creates a new empty line.
|
TextLine(String text)
Creates a new text line using the default font.
|
TextLine(String text,
Font font)
Creates a new text line.
|
TextLine(String text,
Font font,
Paint paint)
Creates a new text line.
|
Modifier and Type | Method and Description |
---|---|
void |
addFragment(TextFragment fragment)
Adds a text fragment to the text line.
|
Size2D |
calculateDimensions(Graphics2D g2)
Calculates the width and height of the text line.
|
void |
draw(Graphics2D g2,
float anchorX,
float anchorY,
TextAnchor anchor,
float rotateX,
float rotateY,
double angle)
Draws the text line.
|
boolean |
equals(Object obj)
Tests this object for equality with an arbitrary object.
|
TextFragment |
getFirstTextFragment()
Returns the first text fragment in the line.
|
TextFragment |
getLastTextFragment()
Returns the last text fragment in the line.
|
int |
hashCode()
Returns a hash code for this object.
|
void |
removeFragment(TextFragment fragment)
Removes a fragment from the line.
|
public TextLine()
public TextLine(String text)
text
- the text (null
not permitted).public TextLine(String text, Font font)
text
- the text (null
not permitted).font
- the text font (null
not permitted).public void addFragment(TextFragment fragment)
fragment
- the text fragment (null
not permitted).public void removeFragment(TextFragment fragment)
fragment
- the fragment to remove.public void draw(Graphics2D g2, float anchorX, float anchorY, TextAnchor anchor, float rotateX, float rotateY, double angle)
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).public Size2D calculateDimensions(Graphics2D g2)
g2
- the graphics device.public TextFragment getFirstTextFragment()
public TextFragment getLastTextFragment()
public boolean equals(Object obj)
Copyright © 2001–2017 JFree.org. All rights reserved.