jdraw.graphicobjects
Class TextArea

java.lang.Object
  |
  +--jdraw.graphicobjects.GraphicObject
        |
        +--jdraw.graphicobjects.TextArea

public class TextArea
extends GraphicObject

A text area.


Field Summary
private  int alignment
          The position of the text from the position of this object (a constant from SwingConstants like CENTER, SOUTH_EAST, ...).
private  float ascent
          The ascent of this text.
private  Rectangle bounding_box
          The bounding box of this text.
private static Cursor CURSOR
          The mouse cursor for this object.
private  Font font
          The font used to display the text.
static String FRIENDLY_NAME
          The friendly name of objects of this class.
private  String text
          The text to be displayed.
 
Fields inherited from class jdraw.graphicobjects.GraphicObject
 
Constructor Summary
TextArea(int x, int y, Color color, String text)
          Creates a new TextArea with specified position, color, text and default font, centered on both axis.
TextArea(int x, int y, Color color, String text, Font font)
          Creates a new TextArea with specified position, color, text and font, centered on both axis.
TextArea(int x, int y, Color color, String text, Font font, int alignment)
          Creates a new TextArea with specified position, color, text, font and alignment.
TextArea(int x, int y, Color color, String text, int alignment)
          Creates a new TextArea with specified position, color, text, alignment and default font.
 
Method Summary
 int getAligment()
          Returns the position of the text from the position of this object (a constant from SwingConstants like CENTER, SOUTH_EAST, ...).
 Rectangle getBoundingBox()
          Returns the bounding box of this text area.
 Cursor getCursor()
          Returns the mouse cursor for this object.
 int getDistanceSq(Point point)
          Returns the square of the minimal distance between this text area and the specified point.
 Font getFont()
          Returns the font used to display the text.
 String getFontName()
          Returns name of the font used to display the text.
 int getFontSize()
          Returns the size of the font used to display the text.
 int getFontStyle()
          Returns the style of the font used to display the text.
 String getFriendlyName()
          Returns the friendly name of this text area.
 String getText()
          Returns the text to be displayed.
 void paint(Graphics g)
          Paints this text area.
 
Methods inherited from class jdraw.graphicobjects.GraphicObject
getColor, getDistance, getDistanceSq, getDistanceSq, getX, getY, updateCachedData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FRIENDLY_NAME

public static final String FRIENDLY_NAME
The friendly name of objects of this class.

See Also:
Constant Field Values

CURSOR

private static final Cursor CURSOR
The mouse cursor for this object.


text

private String text
The text to be displayed.


font

private Font font
The font used to display the text.


alignment

private int alignment
The position of the text from the position of this object (a constant from SwingConstants like CENTER, SOUTH_EAST, ...).


bounding_box

private final Rectangle bounding_box
The bounding box of this text.


ascent

private float ascent
The ascent of this text.

Constructor Detail

TextArea

public TextArea(int x,
                int y,
                Color color,
                String text)
Creates a new TextArea with specified position, color, text and default font, centered on both axis.


TextArea

public TextArea(int x,
                int y,
                Color color,
                String text,
                int alignment)
Creates a new TextArea with specified position, color, text, alignment and default font.


TextArea

public TextArea(int x,
                int y,
                Color color,
                String text,
                Font font)
Creates a new TextArea with specified position, color, text and font, centered on both axis.


TextArea

public TextArea(int x,
                int y,
                Color color,
                String text,
                Font font,
                int alignment)
Creates a new TextArea with specified position, color, text, font and alignment.

Method Detail

getBoundingBox

public Rectangle getBoundingBox()
Returns the bounding box of this text area.

Specified by:
getBoundingBox in class GraphicObject

getCursor

public Cursor getCursor()
Returns the mouse cursor for this object.

Specified by:
getCursor in class GraphicObject

getFriendlyName

public String getFriendlyName()
Returns the friendly name of this text area.

Specified by:
getFriendlyName in class GraphicObject

paint

public void paint(Graphics g)
Paints this text area.

Specified by:
paint in class GraphicObject

getDistanceSq

public int getDistanceSq(Point point)
Returns the square of the minimal distance between this text area and the specified point.

Specified by:
getDistanceSq in class GraphicObject

getFont

public Font getFont()
Returns the font used to display the text.


getFontName

public String getFontName()
Returns name of the font used to display the text.


getFontSize

public int getFontSize()
Returns the size of the font used to display the text.


getFontStyle

public int getFontStyle()
Returns the style of the font used to display the text.


getText

public String getText()
Returns the text to be displayed.


getAligment

public int getAligment()
Returns the position of the text from the position of this object (a constant from SwingConstants like CENTER, SOUTH_EAST, ...).