jdraw.graphicalobjects
Class Rectangle

java.lang.Object
  |
  +--jdraw.graphicalobjects.GraphicalObject
        |
        +--jdraw.graphicalobjects.SizedGraphicalObject
              |
              +--jdraw.graphicalobjects.Rectangle

public class Rectangle
extends SizedGraphicalObject

A graphical rectangle.


Field Summary
private static Cursor CURSOR
          The mouse cursor for this object.
static String FRIENDLYNAME
          The friendly name of objects of this class.
private  Line2D.Double l2dRightLine
          The Line2D object used to compute distances from right edge.
private  Line2D.Double l2dTopLine
          The Line2D object used to compute distances from top edge.
private  Point ptCenter
          The center of this rectangle.
 
Fields inherited from class jdraw.graphicalobjects.SizedGraphicalObject
iHeight, iWidth
 
Fields inherited from class jdraw.graphicalobjects.GraphicalObject
bDragInProgress, colColor, iX, iY, lstPropertyChangeListeners, ptDragAndDropStartPosition, ptInitialObjectPosition, rectInitialBoundingBox
 
Constructor Summary
Rectangle(int iX, int iY, Color colColor, int iWidth, int iHeight)
          Creates a new Rectangle with specified position, color, width and height.
 
Method Summary
 Cursor getCursor()
          Returns the mouse cursor for this object.
 int getDistanceSq(Point ptPoint)
          Returns the square of the minimal distance between this rectangle and the specified point.
 String getFriendlyName()
          Returns the friendly name of this retangle.
 void paint(Graphics g)
          Paints this rectangle.
protected  void updateCachedData()
          Invoked when cached data have to be updated.
 
Methods inherited from class jdraw.graphicalobjects.SizedGraphicalObject
getBoundingBox, getHeight, getPropertyDialog, getWidth, setHeight, setWidth
 
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
 
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.

ptCenter

private final Point ptCenter
The center of this rectangle.

l2dTopLine

private Line2D.Double l2dTopLine
The Line2D object used to compute distances from top edge.

l2dRightLine

private Line2D.Double l2dRightLine
The Line2D object used to compute distances from right edge.
Constructor Detail

Rectangle

public Rectangle(int iX,
                 int iY,
                 Color colColor,
                 int iWidth,
                 int iHeight)
Creates a new Rectangle with specified position, color, width and height.
Method Detail

getCursor

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

getFriendlyName

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

paint

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

getDistanceSq

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

updateCachedData

protected void updateCachedData()
Invoked when cached data have to be updated.
Overrides:
updateCachedData in class GraphicalObject