: Class TextRun

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

## Free.awt
Class TextRun

    java.lang.Object
      |
      +--Free.awt.TextRun

public class TextRun
extends java.lang.Object

TextRun. A single run of text that has a string and a TextStyle. Runs know how to draw themselves with word-wrapping.
Originally from NFC Chat. Modified for use in GNU.FREE

Since:
  1.6
Version:
  1.0 2 April 2001
Author:
  Jason Kitcat

Constructor Summary
`TextRun(java.lang.String text, TextStyle style)`

Method Summary
`boolean` | `contains(int x, int y, int yTranslation)` Check if this TextRun contains the specified point.
`void` | `draw(java.awt.Graphics g, int yOff)` Draw this run of text on the screen, starting at the y Offset specified.
`(package private) int` | `findEnd(int begin, int xOff, int xMax)` Find the index of last last character of the substring that can be drawn before having to wrap.
`java.awt.Rectangle` | `getBoundingRect()` Return the smallest Rectangle that contains this whole TextRun.
`TextStyle` | `getStyle()`
`java.lang.String` | `getText()`
`void` | `prepare(int xMax, java.awt.Dimension preferredSize, java.awt.Point p)` Prepares this run of text for word-wrapped stylized display, breaking it down into discrete Substrings that can be drawn easily.
`void` | `setFont(java.awt.Font f)`
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### TextRun

    public TextRun(java.lang.String text,
                   TextStyle style)

Method Detail

### getStyle

    public TextStyle getStyle()

### getText

    public java.lang.String getText()

### setFont

    public void setFont(java.awt.Font f)

### getBoundingRect

    public java.awt.Rectangle getBoundingRect()

  Return the smallest Rectangle that contains this whole TextRun. Prepare must be called before this will return anything accurate.

### findEnd

    int findEnd(int begin,
                int xOff,
                int xMax)

  Find the index of last last character of the substring that can be drawn before having to wrap.
  Parameters:
    `begin` - the offset of the first character
    `xOff` - the X position that the substring starts at
    `xMax` - the wrapping point
  Returns:
    the index of the last character that can be drawn before wrapping

### prepare

    public void prepare(int xMax,
                        java.awt.Dimension preferredSize,
                        java.awt.Point p)

  Prepares this run of text for word-wrapped stylized display, breaking it down into discrete Substrings that can be drawn easily.
  Parameters:
    `xMax` - the wrapping point (width of the view)
    `preferredSize` - is filled in based xMax
    `the` - Point contains the x, y offset that this TextRun starts at. The values in p get replaced with the Point that the next TextRun should begin at.

### contains

    public boolean contains(int x,
                            int y,
                            int yTranslation)

  Check if this TextRun contains the specified point. This class assumes that the y coordinate has already been translated

### draw

    public void draw(java.awt.Graphics g,
                     int yOff)

  Draw this run of text on the screen, starting at the y Offset specified. Prepare must have been called first, or else nothing will draw
  Parameters:
    `g` - the graphics context to draw on

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

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