jdraw.graphicalobjects
Class TextArea

java.lang.Object
  |
  +--jdraw.graphicalobjects.GraphicalObject
        |
        +--jdraw.graphicalobjects.TextArea

public class TextArea
extends GraphicalObject

A text area.


Field Summary
private static BufferedImage biDummyImage
          A dummy buffered image used to obtain a graphic context.
private static Cursor CURSOR
          The mouse cursor for this object.
private  Font fntFont
          The font used to display the text.
static String FRIENDLYNAME
          The friendly name of objects of this class.
private  int iAlignment
          The position of the text from the position of this object (a constant from SwingConstants like CENTER, SOUTH_EAST, ...).
private  Rectangle rectBoundingBox
          The bounding box of this text.
private  String strText
          The text to be displayed.
 
Fields inherited from class jdraw.graphicalobjects.GraphicalObject
bDragInProgress, colColor, iX, iY, lstPropertyChangeListeners, ptDragAndDropStartPosition, ptInitialObjectPosition, rectInitialBoundingBox
 
Constructor Summary
TextArea(int iX, int iY, Color colColor, String strText)
          Creates a new TextArea with specified position, color, text and default font, centered on both axis.
TextArea(int iX, int iY, Color colColor, String strText, Font fntFont)
          Creates a new TextArea with specified position, color, text and font, centered on both axis.
TextArea(int iX, int iY, Color colColor, String strText, Font fntFont, int iAlignment)
          Creates a new TextArea with specified position, color, text, font and alignment.
TextArea(int iX, int iY, Color colColor, String strText, int iAlignment)
          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 ptPoint)
          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.
 GraphicalObjectProperties getPropertyDialog(Frame frmOwner)
          Returns a dialog box used to set the properties of this graphical object.
 String getText()
          Returns the text to be displayed.
 void paint(Graphics g)
          Paints this text area.
protected  void setAlignment_silent(int iNewAlignment)
          Sets the position of the text from the position of this object (a constant from SwingConstants like CENTER, SOUTH_EAST, ...), without firing any event.
 void setAlignment(int iNewAlignment)
          Sets the position of the text from the position of this object (a constant from SwingConstants like CENTER, SOUTH_EAST, ...).
protected  void setFont_silent(Font fntNewFont)
          Sets the font used to display the text, without firing any event.
protected  void setFont_silent(String strFontName, int iFontStyle, int iFontSize)
          Sets the font used to display the text, without firing any event.
 void setFont(String strFontName, int iFontStyle, int iFontSize)
          Sets the font used to display the text.
protected  void setText_silent(String strNewText)
          Sets the text to be displayed, without firing any event.
 void setText(String strNewText)
          Sets the text to be displayed.
protected  void updateBoundingBox()
          Updates the size of this text area.
 
Methods inherited from class jdraw.graphicalobjects.GraphicalObject
addPropertyChangeListener, commitDragAndDrop, drag, fireBoudingBoxChange, getColor, getDistance, getDistanceSq, getDistanceSq, getX, getY, isDragInProgress, moveTo_silent, moveTo, openPropertyDialog, prepareBoudingBoxEvent, removePropertyChangeListener, rollbackDragAndDrop, setColor_silent, setColor, setX_silent, setX, setY_silent, setY, startDragAndDrop, suspendDragAndDrop, updateCachedData
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

FRIENDLYNAME

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

CURSOR

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

biDummyImage

private static final BufferedImage biDummyImage
A dummy buffered image used to obtain a graphic context.

rectBoundingBox

private final Rectangle rectBoundingBox
The bounding box of this text.

strText

private String strText
The text to be displayed.

fntFont

private Font fntFont
The font used to display the text.

iAlignment

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

TextArea

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

TextArea

public TextArea(int iX,
                int iY,
                Color colColor,
                String strText,
                int iAlignment)
Creates a new TextArea with specified position, color, text, alignment and default font.

TextArea

public TextArea(int iX,
                int iY,
                Color colColor,
                String strText,
                Font fntFont)
Creates a new TextArea with specified position, color, text and font, centered on both axis.

TextArea

public TextArea(int iX,
                int iY,
                Color colColor,
                String strText,
                Font fntFont,
                int iAlignment)
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.
Overrides:
getBoundingBox in class GraphicalObject

getCursor

public Cursor getCursor()
Returns the mouse cursor for this object.
Overrides:
getCursor in class GraphicalObject

getPropertyDialog

public GraphicalObjectProperties getPropertyDialog(Frame frmOwner)
Returns a dialog box used to set the properties of this graphical object. This dialog box is packed and ready to be set visible.
Overrides:
getPropertyDialog in class GraphicalObject

getFriendlyName

public String getFriendlyName()
Returns the friendly name of this text area.
Overrides:
getFriendlyName in class GraphicalObject

paint

public void paint(Graphics g)
Paints this text area.
Overrides:
paint in class GraphicalObject

updateBoundingBox

protected void updateBoundingBox()
Updates the size of this text area.

getDistanceSq

public int getDistanceSq(Point ptPoint)
Returns the square of the minimal distance between this text area and the specified point.
Overrides:
getDistanceSq in class GraphicalObject

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.

setFont

public void setFont(String strFontName,
                    int iFontStyle,
                    int iFontSize)
Sets the font used to display the text.

setFont_silent

protected void setFont_silent(String strFontName,
                              int iFontStyle,
                              int iFontSize)
Sets the font used to display the text, without firing any event.

setFont_silent

protected void setFont_silent(Font fntNewFont)
Sets the font used to display the text, without firing any event.

getText

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

setText

public void setText(String strNewText)
Sets the text to be displayed.

setText_silent

protected void setText_silent(String strNewText)
Sets the text to be displayed, without firing any event.

getAligment

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

setAlignment

public void setAlignment(int iNewAlignment)
Sets the position of the text from the position of this object (a constant from SwingConstants like CENTER, SOUTH_EAST, ...).

setAlignment_silent

protected void setAlignment_silent(int iNewAlignment)
Sets the position of the text from the position of this object (a constant from SwingConstants like CENTER, SOUTH_EAST, ...), without firing any event.