NGP.Graphics
Class RectangularShape

java.lang.Object
  extended byNGP.Graphics.Shape
      extended byNGP.Graphics.RectangularShape
All Implemented Interfaces:
Colorable, EventListener, Graphic, Locatable, MouseListener, MouseMotionListener, Reactor, Rotatable, Sizeable
Direct Known Subclasses:
FilledRectangularShape, FramedRectangularShape

public abstract class RectangularShape
extends Shape
implements Locatable, Sizeable

Used for defining the all of the geometric shapes except for a Line. Added capabilities are the Dimension and Location.

Author:
Matt Chotin (mhc)

Field Summary
 
Fields inherited from class NGP.Graphics.Shape
_awtShape, _dpanel
 
Fields inherited from interface NGP.Colorable
DEFAULT_GRAY
 
Constructor Summary
RectangularShape(DrawingPanel dp, Shape s)
          Create a RectangularShape in the specified DrawingPanel
 
Method Summary
 Dimension getDimension()
          Get the dimensions of this RectangularShape.
 Point getLocation()
          Get the location of this RectangularShape
 void setCenterLocation(Point p)
          Set the location of the RectangularShape so that its center point is at the specified location.
 void setDimension(Dimension d)
          Set the dimensions of this RectangularShape.
 void setLocation(Point p)
          Set the location of this RectangularShape
 void unwrap()
          Set this shape so that it will does not necessarily display in its DrawingPanel
 void wrap()
          Set this shape so that it will always display in its DrawingPanel
 
Methods inherited from class NGP.Graphics.Shape
actualPaint, contains, drag, getBounds, getCenterLocation, getColor, getDrawingPanel, getRotation, hide, intersects, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, paint, react, setColor, setDrawingPanel, setRotation, show
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RectangularShape

public RectangularShape(DrawingPanel dp,
                        Shape s)
Create a RectangularShape in the specified DrawingPanel

Parameters:
dp - the DrawingPanel for this Shape
Method Detail

getDimension

public Dimension getDimension()
Get the dimensions of this RectangularShape.

Specified by:
getDimension in interface Sizeable
Returns:
the Dimension of this RectangularShape
See Also:
setDimension

setDimension

public void setDimension(Dimension d)
Set the dimensions of this RectangularShape.

Specified by:
setDimension in interface Sizeable
Parameters:
d - the new Dimension of this RectangularShape
See Also:
getDimension

getLocation

public Point getLocation()
Get the location of this RectangularShape

Specified by:
getLocation in interface Locatable
Returns:
the Point of this RectangularShape
See Also:
setLocation

setLocation

public void setLocation(Point p)
Set the location of this RectangularShape

Specified by:
setLocation in interface Locatable
Parameters:
p - the new Point for this RectangularShape
See Also:
getLocation

setCenterLocation

public void setCenterLocation(Point p)
Set the location of the RectangularShape so that its center point is at the specified location.

Parameters:
p - the new Point for the center of this RectangularShape

wrap

public void wrap()
Set this shape so that it will always display in its DrawingPanel


unwrap

public void unwrap()
Set this shape so that it will does not necessarily display in its DrawingPanel