com.horstmann.violet.framework
Class MultiLineString

java.lang.Object
  extended by com.horstmann.violet.framework.MultiLineString
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class MultiLineString
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

A string that can extend over multiple lines.

See Also:
Serialized Form

Field Summary
static int CENTER
           
static int LARGE
           
static int LEFT
           
static int NORMAL
           
static int RIGHT
           
static int SMALL
           
 
Constructor Summary
MultiLineString()
          Constructs an empty, centered, normal size multiline string that is not underlined.
 
Method Summary
 java.lang.Object clone()
           
 void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D r)
          Draws this multiline string inside a given rectangle
 java.awt.geom.Rectangle2D getBounds(java.awt.Graphics2D g2)
          Gets the bounding rectangle for this multiline string.
 int getJustification()
          Gets the value of the justification property.
 int getSize()
          Gets the value of the size property.
 java.lang.String getText()
          Gets the value of the text property.
 boolean isUnderlined()
          Gets the value of the underlined property.
 void setJustification(int newValue)
          Sets the value of the justification property.
 void setSize(int newValue)
          Sets the value of the size property.
 void setText(java.lang.String newValue)
          Sets the value of the text property.
 void setUnderlined(boolean newValue)
          Sets the value of the underlined property.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LEFT

public static final int LEFT
See Also:
Constant Field Values

CENTER

public static final int CENTER
See Also:
Constant Field Values

RIGHT

public static final int RIGHT
See Also:
Constant Field Values

LARGE

public static final int LARGE
See Also:
Constant Field Values

NORMAL

public static final int NORMAL
See Also:
Constant Field Values

SMALL

public static final int SMALL
See Also:
Constant Field Values
Constructor Detail

MultiLineString

public MultiLineString()
Constructs an empty, centered, normal size multiline string that is not underlined.

Method Detail

setText

public void setText(java.lang.String newValue)
Sets the value of the text property.

Parameters:
newValue - the text of the multiline string

getText

public java.lang.String getText()
Gets the value of the text property.

Returns:
the text of the multiline string

setJustification

public void setJustification(int newValue)
Sets the value of the justification property.

Parameters:
newValue - the justification, one of LEFT, CENTER, RIGHT

getJustification

public int getJustification()
Gets the value of the justification property.

Returns:
the justification, one of LEFT, CENTER, RIGHT

isUnderlined

public boolean isUnderlined()
Gets the value of the underlined property.

Returns:
true if the text is underlined

setUnderlined

public void setUnderlined(boolean newValue)
Sets the value of the underlined property.

Parameters:
newValue - true to underline the text

setSize

public void setSize(int newValue)
Sets the value of the size property.

Parameters:
newValue - the size, one of SMALL, NORMAL, LARGE

getSize

public int getSize()
Gets the value of the size property.

Returns:
the size, one of SMALL, NORMAL, LARGE

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getBounds

public java.awt.geom.Rectangle2D getBounds(java.awt.Graphics2D g2)
Gets the bounding rectangle for this multiline string.

Parameters:
g2 - the graphics context
Returns:
the bounding rectangle (with top left corner (0,0))

draw

public void draw(java.awt.Graphics2D g2,
                 java.awt.geom.Rectangle2D r)
Draws this multiline string inside a given rectangle

Parameters:
g2 - the graphics context
r - the rectangle into which to place this multiline string

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object