org.jfree.text
Class TextBlock

java.lang.Object
  extended byorg.jfree.text.TextBlock

public class TextBlock
extends java.lang.Object

A list of TextLine objects that form a block of text.

Author:
David Gilbert

Constructor Summary
TextBlock()
          Creates a new empty text block.
 
Method Summary
 void addLine(java.lang.String text, java.awt.Font font)
          Adds a line of text that will be displayed using the specified font.
 void addLine(TextLine line)
          Adds a TextLine to the block.
 java.awt.Dimension calculateDimensions(java.awt.Graphics2D g2)
          Returns the width and height of the text block.
 void draw(java.awt.Graphics2D g2, float x, float y, TextBlockAnchor anchor)
          Draws the text block at a specific location.
 void draw(java.awt.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.
 TextLine getLastLine()
          Returns the last line in the block.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextBlock

public TextBlock()
Creates a new empty text block.

Method Detail

addLine

public void addLine(java.lang.String text,
                    java.awt.Font font)
Adds a line of text that will be displayed using the specified font.

Parameters:
text - the text.
font - the font.

addLine

public void addLine(TextLine line)
Adds a TextLine to the block.

Parameters:
line - the line.

getLastLine

public TextLine getLastLine()
Returns the last line in the block.

Returns:
the last line in the block.

calculateDimensions

public java.awt.Dimension calculateDimensions(java.awt.Graphics2D g2)
Returns the width and height of the text block.

Parameters:
g2 - the graphics device.
Returns:
the width and height.

draw

public void draw(java.awt.Graphics2D g2,
                 float x,
                 float y,
                 TextBlockAnchor anchor)
Draws the text block at a specific location.

Parameters:
g2 - the graphics device.
x - the x-coordinate for the anchor point.
y - the y-coordinate for the anchor point.
anchor - the anchor point.

draw

public void draw(java.awt.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.

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 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).