Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jfree.text
Class TextLine

    java.lang.Object
      org.jfree.text.TextLine

All Implemented Interfaces:
  java.io.Serializable

    public class TextLine

extends java.lang.Object
implements java.io.Serializable

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
See Also:
  Serialized Form

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.
`TextLine(java.lang.String text, java.awt.Font font, java.awt.Paint paint)` Creates a new text line.

Method Summary
`void` | `addFragment(TextFragment fragment)` Adds a text fragment to the text line.
`Size2D` | `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.
`boolean` | `equals(java.lang.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.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, 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 (`null` not permitted).

### TextLine

    public TextLine(java.lang.String text,
                    java.awt.Font font)

  Creates a new text line.

  Parameters:
    `text` - the text (`null` not permitted).
    `font` - the text font (`null` not permitted).

### TextLine

    public TextLine(java.lang.String text,
                    java.awt.Font font,
                    java.awt.Paint paint)

  Creates a new text line.

  Parameters:
    `text` - the text (`null` not permitted).
    `font` - the text font (`null` not permitted).
    `paint` - the text color (`null` not permitted).

Method Detail

### addFragment

    public void addFragment(TextFragment fragment)

  Adds a text fragment to the text line.

  Parameters:
    `fragment` - the text fragment (`null` not permitted).

### removeFragment

    public void removeFragment(TextFragment fragment)

  Removes a fragment from the line.

  Parameters:
    `fragment` - the fragment to remove.

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

### calculateDimensions

    public Size2D calculateDimensions(java.awt.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.

### equals

    public boolean equals(java.lang.Object obj)

  Tests this object for equality with an arbitrary object.

  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `obj` - the object to test against (`null` permitted).
  Returns:
    A boolean.

### hashCode

    public int hashCode()

  Returns a hash code for this object.

  Overrides:
    `hashCode` in class `java.lang.Object`
  Returns:
    A hash code.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD