edu.rit.slides.items
Class TextItem

java.lang.Object
  extended by edu.rit.slides.items.SlideItem
      extended by edu.rit.slides.items.TextItem
All Implemented Interfaces:
Externalizable, Serializable

public class TextItem
extends SlideItem
implements Externalizable

Class TextItem provides a slide item consisting of a single line of text. The text is all one font and color.

The line of text occupies a certain rectangular box. The text box includes the text's ascenders and descenders, but not the leading. The text box may be placed on the slide at one of nine positions relative to a specified "anchor point." The text position is specified by one of the following constants:

The text may optionally have a Bullet attached. The bullet is always located to the left of the text. The offset from the left side of the bullet to the left side of the text is specified when the bullet object is constructed.

Class TextItem keeps track of the "last text item." The static TextItem.last() method returns a reference to the last created text item.

When a TextItem is created, the "last point" (returned by the Point.last() method) is set to the text item's anchor point, offset in the positive Y direction by a distance equal to the "newline factor" times the font size. This is typically the point at which to place the next text item.

Static setDefaultXXX() methods are provided to set the default attribute values (position, font, fill, bullet, and newline factor). If an attribute value is not specified when constructing a text item, the current default attribute value is used.

See Also:
Serialized Form

Field Summary
static int ABOVE
          The text box is positioned above the anchor point.
static int ABOVE_LEFT
          The text box is positioned above and to the left of the anchor point.
static int ABOVE_RIGHT
          The text box is positioned above and to the right of the anchor point.
static int BELOW
          The text box is positioned below the anchor point.
static int BELOW_LEFT
          The text box is positioned below and to the left of the anchor point.
static int BELOW_RIGHT
          The text box is positioned below and to the right of the anchor point.
static int CENTER
          The text box is centered on the anchor point.
static int LEFT
          The text box is positioned to the left of the anchor point.
static Fill NORMAL_FILL
          The normal fill (black).
static Font NORMAL_FONT
          The normal text font (sanserif, plain, 24 point).
static double NORMAL_NEWLINE
          The normal newline factor (1.25).
static int RIGHT
          The text box is positioned to the right of the anchor point.
 
Constructor Summary
TextItem()
          Construct a new, empty text item.
TextItem(String theText)
          Construct a new text item with the given text.
TextItem(String theText, Bullet theBullet)
          Construct a new text item with the given text.
TextItem(String theText, Bullet theBullet, double theNewline)
          Construct a new text item with the given text.
TextItem(String theText, double theNewline)
          Construct a new text item with the given text.
TextItem(String theText, Fill theFill)
          Construct a new text item with the given text.
TextItem(String theText, Fill theFill, Bullet theBullet)
          Construct a new text item with the given text.
TextItem(String theText, Fill theFill, Bullet theBullet, double theNewline)
          Construct a new text item with the given text.
TextItem(String theText, Fill theFill, double theNewline)
          Construct a new text item with the given text.
TextItem(String theText, Font theFont)
          Construct a new text item with the given text.
TextItem(String theText, Font theFont, Bullet theBullet)
          Construct a new text item with the given text.
TextItem(String theText, Font theFont, Bullet theBullet, double theNewline)
          Construct a new text item with the given text.
TextItem(String theText, Font theFont, double theNewline)
          Construct a new text item with the given text.
TextItem(String theText, Font theFont, Fill theFill)
          Construct a new text item with the given text.
TextItem(String theText, Font theFont, Fill theFill, Bullet theBullet)
          Construct a new text item with the given text.
TextItem(String theText, Font theFont, Fill theFill, Bullet theBullet, double theNewline)
          Construct a new text item with the given text.
TextItem(String theText, Font theFont, Fill theFill, double theNewline)
          Construct a new text item with the given text.
TextItem(String theText, int thePosition)
          Construct a new text item with the given text.
TextItem(String theText, int thePosition, Bullet theBullet)
          Construct a new text item with the given text.
TextItem(String theText, int thePosition, Bullet theBullet, double theNewline)
          Construct a new text item with the given text.
TextItem(String theText, int thePosition, double theNewline)
          Construct a new text item with the given text.
TextItem(String theText, int thePosition, Fill theFill)
          Construct a new text item with the given text.
TextItem(String theText, int thePosition, Fill theFill, Bullet theBullet)
          Construct a new text item with the given text.
TextItem(String theText, int thePosition, Fill theFill, Bullet theBullet, double theNewline)
          Construct a new text item with the given text.
TextItem(String theText, int thePosition, Fill theFill, double theNewline)
          Construct a new text item with the given text.
TextItem(String theText, int thePosition, Font theFont)
          Construct a new text item with the given text.
TextItem(String theText, int thePosition, Font theFont, Bullet theBullet)
          Construct a new text item with the given text.
TextItem(String theText, int thePosition, Font theFont, Bullet theBullet, double theNewline)
          Construct a new text item with the given text.
TextItem(String theText, int thePosition, Font theFont, double theNewline)
          Construct a new text item with the given text.
TextItem(String theText, int thePosition, Font theFont, Fill theFill)
          Construct a new text item with the given text.
TextItem(String theText, int thePosition, Font theFont, Fill theFill, Bullet theBullet)
          Construct a new text item with the given text.
TextItem(String theText, int thePosition, Font theFont, Fill theFill, Bullet theBullet, double theNewline)
          Construct a new text item with the given text.
TextItem(String theText, int thePosition, Font theFont, Fill theFill, double theNewline)
          Construct a new text item with the given text.
TextItem(String theText, Point theAnchor)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, Bullet theBullet)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, Bullet theBullet, double theNewline)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, double theNewline)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, Fill theFill)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, Fill theFill, Bullet theBullet)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, Fill theFill, Bullet theBullet, double theNewline)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, Fill theFill, double theNewline)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, Font theFont)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, Font theFont, Bullet theBullet)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, Font theFont, Bullet theBullet, double theNewline)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, Font theFont, double theNewline)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, Font theFont, Fill theFill)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, Font theFont, Fill theFill, Bullet theBullet)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, Font theFont, Fill theFill, Bullet theBullet, double theNewline)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, Font theFont, Fill theFill, double theNewline)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, int thePosition)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, int thePosition, Bullet theBullet)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, int thePosition, Bullet theBullet, double theNewline)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, int thePosition, double theNewline)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, int thePosition, Fill theFill)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, int thePosition, Fill theFill, Bullet theBullet)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, int thePosition, Fill theFill, Bullet theBullet, double theNewline)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, int thePosition, Fill theFill, double theNewline)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, int thePosition, Font theFont)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, int thePosition, Font theFont, Bullet theBullet)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, int thePosition, Font theFont, Bullet theBullet, double theNewline)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, int thePosition, Font theFont, double theNewline)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, int thePosition, Font theFont, Fill theFill)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, int thePosition, Font theFont, Fill theFill, Bullet theBullet)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, int thePosition, Font theFont, Fill theFill, Bullet theBullet, double theNewline)
          Construct a new text item with the given text and anchor point.
TextItem(String theText, Point theAnchor, int thePosition, Font theFont, Fill theFill, double theNewline)
          Construct a new text item with the given text and anchor point.
 
Method Summary
 void draw(Graphics2D g2d)
          Draw this slide item in the given graphics context.
static TextItem last()
          Returns the last text item created.
 Point location()
          Returns this text item's location, namely its anchor point.
 Point next()
          Returns this text item's next location.
 void readExternal(ObjectInput in)
          Read this text item from the given object input stream.
static void setDefaultBullet(Bullet theBullet)
          Set the default bullet.
static void setDefaultFill(Fill theFill)
          Set the default fill paint.
static void setDefaultFont(Font theFont)
          Set the default font.
static void setDefaultNewline(double theNewline)
          Set the default newline factor.
static void setDefaultPosition(int thePosition)
          Set the default text position.
 void writeExternal(ObjectOutput out)
          Write this text item to the given object output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ABOVE_LEFT

public static final int ABOVE_LEFT
The text box is positioned above and to the left of the anchor point.

See Also:
Constant Field Values

ABOVE

public static final int ABOVE
The text box is positioned above the anchor point.

See Also:
Constant Field Values

ABOVE_RIGHT

public static final int ABOVE_RIGHT
The text box is positioned above and to the right of the anchor point.

See Also:
Constant Field Values

LEFT

public static final int LEFT
The text box is positioned to the left of the anchor point.

See Also:
Constant Field Values

CENTER

public static final int CENTER
The text box is centered on the anchor point.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
The text box is positioned to the right of the anchor point.

See Also:
Constant Field Values

BELOW_LEFT

public static final int BELOW_LEFT
The text box is positioned below and to the left of the anchor point.

See Also:
Constant Field Values

BELOW

public static final int BELOW
The text box is positioned below the anchor point.

See Also:
Constant Field Values

BELOW_RIGHT

public static final int BELOW_RIGHT
The text box is positioned below and to the right of the anchor point.

See Also:
Constant Field Values

NORMAL_FONT

public static final Font NORMAL_FONT
The normal text font (sanserif, plain, 24 point).


NORMAL_FILL

public static final Fill NORMAL_FILL
The normal fill (black).


NORMAL_NEWLINE

public static final double NORMAL_NEWLINE
The normal newline factor (1.25).

See Also:
Constant Field Values
Constructor Detail

TextItem

public TextItem()
Construct a new, empty text item.


TextItem

public TextItem(String theText)
Construct a new text item with the given text. The anchor point is Point.last(). The default text position is used. The default font is used. The default fill paint is used. The text has no bullet. The default newline factor is used.

Parameters:
theText - Text.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null.

TextItem

public TextItem(String theText,
                double theNewline)
Construct a new text item with the given text. The anchor point is Point.last(). The default text position is used. The default font is used. The default fill paint is used. The text has no bullet. The given newline factor is used.

Parameters:
theText - Text.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null.

TextItem

public TextItem(String theText,
                Bullet theBullet)
Construct a new text item with the given text. The anchor point is Point.last(). The default text position is used. The default font is used. The default fill paint is used. The given bullet is used. The default newline factor is used.

Parameters:
theText - Text.
theBullet - Bullet. If null, no bullet is drawn.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null.

TextItem

public TextItem(String theText,
                Bullet theBullet,
                double theNewline)
Construct a new text item with the given text. The anchor point is Point.last(). The default text position is used. The default font is used. The default fill paint is used. The given bullet is used. The given newline factor is used.

Parameters:
theText - Text.
theBullet - Bullet. If null, no bullet is drawn.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null.

TextItem

public TextItem(String theText,
                Fill theFill)
Construct a new text item with the given text. The anchor point is Point.last(). The default text position is used. The default font is used. The given fill paint is used. The text has no bullet. The default newline factor is used.

Parameters:
theText - Text.
theFill - Fill paint.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFill is null.

TextItem

public TextItem(String theText,
                Fill theFill,
                double theNewline)
Construct a new text item with the given text. The anchor point is Point.last(). The default text position is used. The default font is used. The given fill paint is used. The text has no bullet. The given newline factor is used.

Parameters:
theText - Text.
theFill - Fill paint.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFill is null.

TextItem

public TextItem(String theText,
                Fill theFill,
                Bullet theBullet)
Construct a new text item with the given text. The anchor point is Point.last(). The default text position is used. The default font is used. The given fill paint is used. The given bullet is used. The default newline factor is used.

Parameters:
theText - Text.
theFill - Fill paint.
theBullet - Bullet. If null, no bullet is drawn.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFill is null.

TextItem

public TextItem(String theText,
                Fill theFill,
                Bullet theBullet,
                double theNewline)
Construct a new text item with the given text. The anchor point is Point.last(). The default text position is used. The default font is used. The given fill paint is used. The given bullet is used. The given newline factor is used.

Parameters:
theText - Text.
theFill - Fill paint.
theBullet - Bullet. If null, no bullet is drawn.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFill is null.

TextItem

public TextItem(String theText,
                Font theFont)
Construct a new text item with the given text. The anchor point is Point.last(). The default text position is used. The given font is used. The default fill paint is used. The text has no bullet. The default newline factor is used.

Parameters:
theText - Text.
theFont - Font.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFont is null.

TextItem

public TextItem(String theText,
                Font theFont,
                double theNewline)
Construct a new text item with the given text. The anchor point is Point.last(). The default text position is used. The given font is used. The default fill paint is used. The text has no bullet. The given newline factor is used.

Parameters:
theText - Text.
theFont - Font.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFont is null.

TextItem

public TextItem(String theText,
                Font theFont,
                Bullet theBullet)
Construct a new text item with the given text. The anchor point is Point.last(). The default text position is used. The given font is used. The default fill paint is used. The given bullet is used. The default newline factor is used.

Parameters:
theText - Text.
theFont - Font.
theBullet - Bullet. If null, no bullet is drawn.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFont is null.

TextItem

public TextItem(String theText,
                Font theFont,
                Bullet theBullet,
                double theNewline)
Construct a new text item with the given text. The anchor point is Point.last(). The default text position is used. The given font is used. The default fill paint is used. The given bullet is used. The given newline factor is used.

Parameters:
theText - Text.
theFont - Font.
theBullet - Bullet. If null, no bullet is drawn.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFont is null.

TextItem

public TextItem(String theText,
                Font theFont,
                Fill theFill)
Construct a new text item with the given text. The anchor point is Point.last(). The default text position is used. The given font is used. The given fill paint is used. The text has no bullet. The default newline factor is used.

Parameters:
theText - Text.
theFont - Font.
theFill - Fill paint.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFont is null or theFill is null.

TextItem

public TextItem(String theText,
                Font theFont,
                Fill theFill,
                double theNewline)
Construct a new text item with the given text. The anchor point is Point.last(). The default text position is used. The given font is used. The given fill paint is used. The text has no bullet. The given newline factor is used.

Parameters:
theText - Text.
theFont - Font.
theFill - Fill paint.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFont is null or theFill is null.

TextItem

public TextItem(String theText,
                Font theFont,
                Fill theFill,
                Bullet theBullet)
Construct a new text item with the given text. The anchor point is Point.last(). The default text position is used. The given font is used. The given fill paint is used. The given bullet is used. The default newline factor is used.

Parameters:
theText - Text.
theFont - Font.
theFill - Fill paint.
theBullet - Bullet. If null, no bullet is drawn.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFont is null or theFill is null.

TextItem

public TextItem(String theText,
                Font theFont,
                Fill theFill,
                Bullet theBullet,
                double theNewline)
Construct a new text item with the given text. The anchor point is Point.last(). The default text position is used. The given font is used. The given fill paint is used. The given bullet is used. The given newline factor is used.

Parameters:
theText - Text.
theFont - Font.
theFill - Fill paint.
theBullet - Bullet. If null, no bullet is drawn.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFont is null or theFill is null.

TextItem

public TextItem(String theText,
                int thePosition)
Construct a new text item with the given text. The anchor point is Point.last(). The given text position is used. The default font is used. The default fill paint is used. The text has no bullet. The default newline factor is used.

Parameters:
theText - Text.
thePosition - Text position relative to the anchor point.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                int thePosition,
                double theNewline)
Construct a new text item with the given text. The anchor point is Point.last(). The given text position is used. The default font is used. The default fill paint is used. The text has no bullet. The given newline factor is used.

Parameters:
theText - Text.
thePosition - Text position relative to the anchor point.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                int thePosition,
                Bullet theBullet)
Construct a new text item with the given text. The anchor point is Point.last(). The given text position is used. The default font is used. The default fill paint is used. The given bullet is used. The default newline factor is used.

Parameters:
theText - Text.
thePosition - Text position relative to the anchor point.
theBullet - Bullet. If null, no bullet is drawn.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                int thePosition,
                Bullet theBullet,
                double theNewline)
Construct a new text item with the given text. The anchor point is Point.last(). The given text position is used. The default font is used. The default fill paint is used. The given bullet is used. The given newline factor is used.

Parameters:
theText - Text.
thePosition - Text position relative to the anchor point.
theBullet - Bullet. If null, no bullet is drawn.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                int thePosition,
                Fill theFill)
Construct a new text item with the given text. The anchor point is Point.last(). The given text position is used. The default font is used. The given fill paint is used. The text has no bullet. The default newline factor is used.

Parameters:
theText - Text.
thePosition - Text position relative to the anchor point.
theFill - Fill paint.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFill is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                int thePosition,
                Fill theFill,
                double theNewline)
Construct a new text item with the given text. The anchor point is Point.last(). The given text position is used. The default font is used. The given fill paint is used. The text has no bullet. The given newline factor is used.

Parameters:
theText - Text.
thePosition - Text position relative to the anchor point.
theFill - Fill paint.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFill is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                int thePosition,
                Fill theFill,
                Bullet theBullet)
Construct a new text item with the given text. The anchor point is Point.last(). The given text position is used. The default font is used. The given fill paint is used. The given bullet is used. The default newline factor is used.

Parameters:
theText - Text.
thePosition - Text position relative to the anchor point.
theFill - Fill paint.
theBullet - Bullet. If null, no bullet is drawn.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFill is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                int thePosition,
                Fill theFill,
                Bullet theBullet,
                double theNewline)
Construct a new text item with the given text. The anchor point is Point.last(). The given text position is used. The default font is used. The given fill paint is used. The given bullet is used. The given newline factor is used.

Parameters:
theText - Text.
thePosition - Text position relative to the anchor point.
theFill - Fill paint.
theBullet - Bullet. If null, no bullet is drawn.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFill is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                int thePosition,
                Font theFont)
Construct a new text item with the given text. The anchor point is Point.last(). The given text position is used. The given font is used. The default fill paint is used. The text has no bullet. The default newline factor is used.

Parameters:
theText - Text.
thePosition - Text position relative to the anchor point.
theFont - Font.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFont is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                int thePosition,
                Font theFont,
                double theNewline)
Construct a new text item with the given text. The anchor point is Point.last(). The given text position is used. The given font is used. The default fill paint is used. The text has no bullet. The given newline factor is used.

Parameters:
theText - Text.
thePosition - Text position relative to the anchor point.
theFont - Font.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFont is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                int thePosition,
                Font theFont,
                Bullet theBullet)
Construct a new text item with the given text. The anchor point is Point.last(). The given text position is used. The given font is used. The default fill paint is used. The given bullet is used. The default newline factor is used.

Parameters:
theText - Text.
thePosition - Text position relative to the anchor point.
theFont - Font.
theBullet - Bullet. If null, no bullet is drawn.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFont is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                int thePosition,
                Font theFont,
                Bullet theBullet,
                double theNewline)
Construct a new text item with the given text. The anchor point is Point.last(). The given text position is used. The given font is used. The default fill paint is used. The given bullet is used. The given newline factor is used.

Parameters:
theText - Text.
thePosition - Text position relative to the anchor point.
theFont - Font.
theBullet - Bullet. If null, no bullet is drawn.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFont is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                int thePosition,
                Font theFont,
                Fill theFill)
Construct a new text item with the given text. The anchor point is Point.last(). The given text position is used. The given font is used. The given fill paint is used. The text has no bullet. The default newline factor is used.

Parameters:
theText - Text.
thePosition - Text position relative to the anchor point.
theFont - Font.
theFill - Fill paint.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFont is null or theFill is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                int thePosition,
                Font theFont,
                Fill theFill,
                double theNewline)
Construct a new text item with the given text. The anchor point is Point.last(). The given text position is used. The given font is used. The given fill paint is used. The text has no bullet. The given newline factor is used.

Parameters:
theText - Text.
thePosition - Text position relative to the anchor point.
theFont - Font.
theFill - Fill paint.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFont is null or theFill is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                int thePosition,
                Font theFont,
                Fill theFill,
                Bullet theBullet)
Construct a new text item with the given text. The anchor point is Point.last(). The given text position is used. The given font is used. The given fill paint is used. The given bullet is used. The default newline factor is used.

Parameters:
theText - Text.
thePosition - Text position relative to the anchor point.
theFont - Font.
theFill - Fill paint.
theBullet - Bullet. If null, no bullet is drawn.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFont is null or theFill is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                int thePosition,
                Font theFont,
                Fill theFill,
                Bullet theBullet,
                double theNewline)
Construct a new text item with the given text. The anchor point is Point.last(). The given text position is used. The given font is used. The given fill paint is used. The given bullet is used. The given newline factor is used.

Parameters:
theText - Text.
thePosition - Text position relative to the anchor point.
theFont - Font.
theFill - Fill paint.
theBullet - Bullet. If null, no bullet is drawn.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theFont is null or theFill is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                Point theAnchor)
Construct a new text item with the given text and anchor point. The default text position is used. The default font is used. The default fill paint is used. The text has no bullet. The default newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null.

TextItem

public TextItem(String theText,
                Point theAnchor,
                double theNewline)
Construct a new text item with the given text and anchor point. The default text position is used. The default font is used. The default fill paint is used. The text has no bullet. The given newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null.

TextItem

public TextItem(String theText,
                Point theAnchor,
                Bullet theBullet)
Construct a new text item with the given text and anchor point. The default text position is used. The default font is used. The default fill paint is used. The given bullet is used. The default newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
theBullet - Bullet. If null, no bullet is drawn.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null.

TextItem

public TextItem(String theText,
                Point theAnchor,
                Bullet theBullet,
                double theNewline)
Construct a new text item with the given text and anchor point. The default text position is used. The default font is used. The default fill paint is used. The given bullet is used. The given newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
theBullet - Bullet. If null, no bullet is drawn.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null.

TextItem

public TextItem(String theText,
                Point theAnchor,
                Fill theFill)
Construct a new text item with the given text and anchor point. The default text position is used. The default font is used. The given fill paint is used. The text has no bullet. The default newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
theFill - Fill paint.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFill is null.

TextItem

public TextItem(String theText,
                Point theAnchor,
                Fill theFill,
                double theNewline)
Construct a new text item with the given text and anchor point. The default text position is used. The default font is used. The given fill paint is used. The text has no bullet. The given newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
theFill - Fill paint.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFill is null.

TextItem

public TextItem(String theText,
                Point theAnchor,
                Fill theFill,
                Bullet theBullet)
Construct a new text item with the given text and anchor point. The default text position is used. The default font is used. The given fill paint is used. The given bullet is used. The default newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
theFill - Fill paint.
theBullet - Bullet. If null, no bullet is drawn.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFill is null.

TextItem

public TextItem(String theText,
                Point theAnchor,
                Fill theFill,
                Bullet theBullet,
                double theNewline)
Construct a new text item with the given text and anchor point. The default text position is used. The default font is used. The given fill paint is used. The given bullet is used. The given newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
theFill - Fill paint.
theBullet - Bullet. If null, no bullet is drawn.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFill is null.

TextItem

public TextItem(String theText,
                Point theAnchor,
                Font theFont)
Construct a new text item with the given text and anchor point. The default text position is used. The given font is used. The default fill paint is used. The text has no bullet. The default newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
theFont - Font.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFont is null.

TextItem

public TextItem(String theText,
                Point theAnchor,
                Font theFont,
                double theNewline)
Construct a new text item with the given text and anchor point. The default text position is used. The given font is used. The default fill paint is used. The text has no bullet. The given newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
theFont - Font.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFont is null.

TextItem

public TextItem(String theText,
                Point theAnchor,
                Font theFont,
                Bullet theBullet)
Construct a new text item with the given text and anchor point. The default text position is used. The given font is used. The default fill paint is used. The given bullet is used. The default newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
theFont - Font.
theBullet - Bullet. If null, no bullet is drawn.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFont is null.

TextItem

public TextItem(String theText,
                Point theAnchor,
                Font theFont,
                Bullet theBullet,
                double theNewline)
Construct a new text item with the given text and anchor point. The default text position is used. The given font is used. The default fill paint is used. The given bullet is used. The given newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
theFont - Font.
theBullet - Bullet. If null, no bullet is drawn.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFont is null.

TextItem

public TextItem(String theText,
                Point theAnchor,
                Font theFont,
                Fill theFill)
Construct a new text item with the given text and anchor point. The default text position is used. The given font is used. The given fill paint is used. The text has no bullet. The default newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
theFont - Font.
theFill - Fill paint.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFont is null or theFill is null.

TextItem

public TextItem(String theText,
                Point theAnchor,
                Font theFont,
                Fill theFill,
                double theNewline)
Construct a new text item with the given text and anchor point. The default text position is used. The given font is used. The given fill paint is used. The text has no bullet. The given newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
theFont - Font.
theFill - Fill paint.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFont is null or theFill is null.

TextItem

public TextItem(String theText,
                Point theAnchor,
                Font theFont,
                Fill theFill,
                Bullet theBullet)
Construct a new text item with the given text and anchor point. The default text position is used. The given font is used. The given fill paint is used. The given bullet is used. The default newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
theFont - Font.
theFill - Fill paint.
theBullet - Bullet. If null, no bullet is drawn.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFont is null or theFill is null.

TextItem

public TextItem(String theText,
                Point theAnchor,
                Font theFont,
                Fill theFill,
                Bullet theBullet,
                double theNewline)
Construct a new text item with the given text and anchor point. The default text position is used. The given font is used. The given fill paint is used. The given bullet is used. The given newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
theFont - Font.
theFill - Fill paint.
theBullet - Bullet. If null, no bullet is drawn.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFont is null or theFill is null.

TextItem

public TextItem(String theText,
                Point theAnchor,
                int thePosition)
Construct a new text item with the given text and anchor point. The given text position is used. The default font is used. The default fill paint is used. The text has no bullet. The default newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
thePosition - Text position relative to the anchor point.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                Point theAnchor,
                int thePosition,
                double theNewline)
Construct a new text item with the given text and anchor point. The given text position is used. The default font is used. The default fill paint is used. The text has no bullet. The given newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
thePosition - Text position relative to the anchor point.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                Point theAnchor,
                int thePosition,
                Bullet theBullet)
Construct a new text item with the given text and anchor point. The given text position is used. The default font is used. The default fill paint is used. The given bullet is used. The default newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
thePosition - Text position relative to the anchor point.
theBullet - Bullet. If null, no bullet is drawn.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                Point theAnchor,
                int thePosition,
                Bullet theBullet,
                double theNewline)
Construct a new text item with the given text and anchor point. The given text position is used. The default font is used. The default fill paint is used. The given bullet is used. The given newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
thePosition - Text position relative to the anchor point.
theBullet - Bullet. If null, no bullet is drawn.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                Point theAnchor,
                int thePosition,
                Fill theFill)
Construct a new text item with the given text and anchor point. The given text position is used. The default font is used. The given fill paint is used. The text has no bullet. The default newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
thePosition - Text position relative to the anchor point.
theFill - Fill paint.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFill is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                Point theAnchor,
                int thePosition,
                Fill theFill,
                double theNewline)
Construct a new text item with the given text and anchor point. The given text position is used. The default font is used. The given fill paint is used. The text has no bullet. The given newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
thePosition - Text position relative to the anchor point.
theFill - Fill paint.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFill is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                Point theAnchor,
                int thePosition,
                Fill theFill,
                Bullet theBullet)
Construct a new text item with the given text and anchor point. The given text position is used. The default font is used. The given fill paint is used. The given bullet is used. The default newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
thePosition - Text position relative to the anchor point.
theFill - Fill paint.
theBullet - Bullet. If null, no bullet is drawn.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFill is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                Point theAnchor,
                int thePosition,
                Fill theFill,
                Bullet theBullet,
                double theNewline)
Construct a new text item with the given text and anchor point. The given text position is used. The default font is used. The given fill paint is used. The given bullet is used. The given newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
thePosition - Text position relative to the anchor point.
theFill - Fill paint.
theBullet - Bullet. If null, no bullet is drawn.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFill is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                Point theAnchor,
                int thePosition,
                Font theFont)
Construct a new text item with the given text and anchor point. The given text position is used. The given font is used. The default fill paint is used. The text has no bullet. The default newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
thePosition - Text position relative to the anchor point.
theFont - Font.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFont is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                Point theAnchor,
                int thePosition,
                Font theFont,
                double theNewline)
Construct a new text item with the given text and anchor point. The given text position is used. The given font is used. The default fill paint is used. The text has no bullet. The given newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
thePosition - Text position relative to the anchor point.
theFont - Font.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFont is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                Point theAnchor,
                int thePosition,
                Font theFont,
                Bullet theBullet)
Construct a new text item with the given text and anchor point. The given text position is used. The given font is used. The default fill paint is used. The given bullet is used. The default newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
thePosition - Text position relative to the anchor point.
theFont - Font.
theBullet - Bullet. If null, no bullet is drawn.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFont is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                Point theAnchor,
                int thePosition,
                Font theFont,
                Bullet theBullet,
                double theNewline)
Construct a new text item with the given text and anchor point. The given text position is used. The given font is used. The default fill paint is used. The given bullet is used. The given newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
thePosition - Text position relative to the anchor point.
theFont - Font.
theBullet - Bullet. If null, no bullet is drawn.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFont is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                Point theAnchor,
                int thePosition,
                Font theFont,
                Fill theFill)
Construct a new text item with the given text and anchor point. The given text position is used. The given font is used. The given fill paint is used. The text has no bullet. The default newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
thePosition - Text position relative to the anchor point.
theFont - Font.
theFill - Fill paint.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFont is null or theFill is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                Point theAnchor,
                int thePosition,
                Font theFont,
                Fill theFill,
                double theNewline)
Construct a new text item with the given text and anchor point. The given text position is used. The given font is used. The given fill paint is used. The text has no bullet. The given newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
thePosition - Text position relative to the anchor point.
theFont - Font.
theFill - Fill paint.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFont is null or theFill is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                Point theAnchor,
                int thePosition,
                Font theFont,
                Fill theFill,
                Bullet theBullet)
Construct a new text item with the given text and anchor point. The given text position is used. The given font is used. The given fill paint is used. The given bullet is used. The default newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
thePosition - Text position relative to the anchor point.
theFont - Font.
theFill - Fill paint.
theBullet - Bullet. If null, no bullet is drawn.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFont is null or theFill is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

TextItem

public TextItem(String theText,
                Point theAnchor,
                int thePosition,
                Font theFont,
                Fill theFill,
                Bullet theBullet,
                double theNewline)
Construct a new text item with the given text and anchor point. The given text position is used. The given font is used. The given fill paint is used. The given bullet is used. The given newline factor is used.

Parameters:
theText - Text.
theAnchor - Anchor point.
thePosition - Text position relative to the anchor point.
theFont - Font.
theFill - Fill paint.
theBullet - Bullet. If null, no bullet is drawn.
theNewline - Newline factor.
Throws:
NullPointerException - (unchecked exception) Thrown if theText is null or theAnchor is null or theFont is null or theFill is null.
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.
Method Detail

last

public static TextItem last()
Returns the last text item created. If no text items have been created yet, null is returned.


setDefaultPosition

public static void setDefaultPosition(int thePosition)
Set the default text position. Before calling this method the first time, the default text position is BELOW_RIGHT.

Parameters:
thePosition - Default text position relative to the anchor point.
Throws:
IllegalArgumentException - (unchecked exception) Thrown if thePosition is not one of the allowed values.

setDefaultFont

public static void setDefaultFont(Font theFont)
Set the default font. Before calling this method the first time, the default font is sanserif, plain, 24 point.

Parameters:
theFont - Font.
Throws:
NullPointerException - (unchecked exception) Thrown if theFont is null.

setDefaultFill

public static void setDefaultFill(Fill theFill)
Set the default fill paint. Before calling this method the first time, the default fill paint is black.

Parameters:
theFill - Fill paint.
Throws:
NullPointerException - (unchecked exception) Thrown if theFill is null.

setDefaultBullet

public static void setDefaultBullet(Bullet theBullet)
Set the default bullet. Before calling this method the first time, the default is no bullet.

Parameters:
theBullet - Bullet. If null, no bullet is drawn.

setDefaultNewline

public static void setDefaultNewline(double theNewline)
Set the default newline factor. Before calling this method the first time, the default newline factor is 1.25.

Parameters:
theNewline - Newline factor.

location

public Point location()
Returns this text item's location, namely its anchor point.


next

public Point next()
Returns this text item's next location. The next location is this text item's anchor point, offset in the positive Y direction by a distance equal to this text item's newline factor times this text item's font size. This is typically the point at which to place the next text item.


draw

public void draw(Graphics2D g2d)
Draw this slide item in the given graphics context. This method is allowed to change the graphics context's paint, stroke, and transform, and it doesn't have to change them back.

Specified by:
draw in class SlideItem
Parameters:
g2d - 2-D graphics context.

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Write this text item to the given object output stream.

Specified by:
writeExternal in interface Externalizable
Parameters:
out - Object output stream.
Throws:
IOException - Thrown if an I/O error occurred.

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Read this text item from the given object input stream.

Specified by:
readExternal in interface Externalizable
Parameters:
in - Object input stream.
Throws:
IOException - Thrown if an I/O error occurred.
ClassNotFoundException - Thrown if any class needed to deserialize this text item cannot be found.


Copyright © 2001-2006 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.