public class TextBlock extends Object implements Serializable
TextLine
objects that form a block of text.Constructor and Description |
---|
TextBlock()
Creates a new empty text block.
|
Modifier and Type | Method and Description |
---|---|
void |
addLine(String text,
Font font,
Paint paint)
Adds a line of text that will be displayed using the specified font.
|
void |
addLine(TextLine line)
Adds a
TextLine to the block. |
Shape |
calculateBounds(Graphics2D g2,
float anchorX,
float anchorY,
TextBlockAnchor anchor,
float rotateX,
float rotateY,
double angle)
Returns the bounds of the text block.
|
Size2D |
calculateDimensions(Graphics2D g2)
Returns the width and height of the text block.
|
void |
draw(Graphics2D g2,
float x,
float y,
TextBlockAnchor anchor)
Draws the text block at a specific location.
|
void |
draw(Graphics2D g2,
float anchorX,
float anchorY,
TextBlockAnchor anchor,
float rotateX,
float rotateY,
double angle)
Draws the text block, aligning it with the specified anchor point and
rotating it about the specified rotation point.
|
boolean |
equals(Object obj)
Tests this object for equality with an arbitrary object.
|
TextLine |
getLastLine()
Returns the last line in the block.
|
HorizontalAlignment |
getLineAlignment()
Returns the alignment of the lines of text within the block.
|
List |
getLines()
Returns an unmodifiable list containing the lines for the text block.
|
int |
hashCode()
Returns a hash code for this object.
|
void |
setLineAlignment(HorizontalAlignment alignment)
Sets the alignment of the lines of text within the block.
|
public HorizontalAlignment getLineAlignment()
null
).public void setLineAlignment(HorizontalAlignment alignment)
alignment
- the alignment (null
not permitted).public void addLine(String text, Font font, Paint paint)
text
- the text.font
- the font.paint
- the paint.public void addLine(TextLine line)
TextLine
to the block.line
- the line.public TextLine getLastLine()
public List getLines()
TextLine
objects.public Size2D calculateDimensions(Graphics2D g2)
g2
- the graphics device.public Shape calculateBounds(Graphics2D g2, float anchorX, float anchorY, TextBlockAnchor anchor, float rotateX, float rotateY, double angle)
g2
- the graphics device (null
not permitted).anchorX
- the x-coordinate for the anchor point.anchorY
- the y-coordinate for the anchor point.anchor
- the text block anchor (null
not permitted).rotateX
- the x-coordinate for the rotation point.rotateY
- the y-coordinate for the rotation point.angle
- the rotation angle.public void draw(Graphics2D g2, float x, float y, TextBlockAnchor anchor)
g2
- the graphics device.x
- the x-coordinate for the anchor point.y
- the y-coordinate for the anchor point.anchor
- the anchor point.public void draw(Graphics2D g2, float anchorX, float anchorY, TextBlockAnchor 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 block that is aligned to the
anchor point.rotateX
- the x-coordinate for the rotation point.rotateY
- the x-coordinate for the rotation point.angle
- the rotation (in radians).public boolean equals(Object obj)
Copyright © 2001–2017 JFree.org. All rights reserved.