org.jfree.text
Class TextLine

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

public class TextLine
extends java.lang.Object

A sequence of TextFragment objects that together form a line of text. A sequence of text lines is managed by the TextBlock class.

Author:
David Gilbert

Constructor Summary
TextLine()
          Creates a new empty line.
TextLine(java.lang.String text)
          Creates a new text line using the default font.
TextLine(java.lang.String text, java.awt.Font font)
          Creates a new text line.
 
Method Summary
 void addFragment(TextFragment fragment)
          Adds a text fragment to the text line.
 java.awt.Dimension calculateDimensions(java.awt.Graphics2D g2)
          Calculates the width and height of the text line.
 void draw(java.awt.Graphics2D g2, float anchorX, float anchorY, TextAnchor anchor, float rotateX, float rotateY, double angle)
          Draws the text line.
 TextFragment getFirstTextFragment()
          Returns the first text fragment in the line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextLine

public TextLine()
Creates a new empty line.


TextLine

public TextLine(java.lang.String text)
Creates a new text line using the default font.

Parameters:
text - the text.

TextLine

public TextLine(java.lang.String text,
                java.awt.Font font)
Creates a new text line.

Parameters:
text - the text.
font - the text font.
Method Detail

addFragment

public void addFragment(TextFragment fragment)
Adds a text fragment to the text line.

Parameters:
fragment - the text fragment.

calculateDimensions

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

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

draw

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

getFirstTextFragment

public TextFragment getFirstTextFragment()
Returns the first text fragment in the line.

Returns:
the first text fragment in the line.