jdraw.graphics
Class PolygonObject

java.lang.Object
  |
  +--jdraw.graphics.GraphicObject
        |
        +--jdraw.graphics.PolygonObject
All Implemented Interfaces:
java.io.Serializable

public class PolygonObject
extends GraphicObject

Class PolygonObject is the GraphicObject extension which holds a polygon shape.

See Also:
Serialized Form

Fields inherited from class jdraw.graphics.GraphicObject
arrowsOn, backgroundColor, color, controlPoints, graphicType, paint, shape, stroke
 
Constructor Summary
PolygonObject(java.awt.Color c, java.awt.Color bgc, java.util.Vector p, java.util.Vector cPoints, java.awt.BasicStroke bs)
          Construct this with the given Colors, FillStyle, and ControlPoints objects.
PolygonObject(java.awt.Point pt1, java.awt.Color c, java.awt.Color bgc, java.util.Vector p, java.awt.BasicStroke bs)
          Construct this with the given Point, Colors, FillStyle, and ControlPoints objects.
 
Method Summary
 void addPoint(java.awt.Point clickedPoint)
          Adds the passed in Point object to the points in this.shape.
 java.lang.Object clone()
          returns - A copy of this.
 void setControlPoints()
          Sets this.controlPoints based on the current PathIterator of this.shape.
 void setLastPoint(java.awt.Point dragPoint)
          Method setLastPoint is overwritten in PolygonObject, PolylineObject, CurveObject, and CurvedShapeObject.
 void setShape()
          Sets this.shape based on the points currently in this.controlPoints.
 
Methods inherited from class jdraw.graphics.GraphicObject
containedIn, deriveImage, draw, flipHorizontally, flipVertically, getBackgroundColor, getColor, getControlPoints, getGraphicType, getMaxX, getMaxY, getMinX, getMinY, getSaveBundle, getShape, getStroke, getTouchedControlPoint, isPointOnShape, rotate, setArrows, setBackgroundColor, setColor, setHorizontalCenter, setMaxX, setMaxY, setMinX, setMinY, setPaint, setSecondPoint, setStroke, setVerticalCenter, translate, translateControlPoint
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolygonObject

public PolygonObject(java.awt.Color c,
                     java.awt.Color bgc,
                     java.util.Vector p,
                     java.util.Vector cPoints,
                     java.awt.BasicStroke bs)
Construct this with the given Colors, FillStyle, and ControlPoints objects.
Parameters:
c - - The Color object to store in this.color.
bgc - - The Color object to store in this.backgroundColor.
p - - The Vector to store in this.paint.
cPoints - - Vector object to store in this.controlPoints.
bs - - The BasicStroke object to store in this.stroke.

PolygonObject

public PolygonObject(java.awt.Point pt1,
                     java.awt.Color c,
                     java.awt.Color bgc,
                     java.util.Vector p,
                     java.awt.BasicStroke bs)
Construct this with the given Point, Colors, FillStyle, and ControlPoints objects.
Parameters:
pt1 - - The Point object at which to start the GeneralPath.
c - - The Color object to store in this.color.
bgc - - The Color object to store in this.backgroundColor.
p - - The Vector to store in this.paint.
bs - - The BasicStroke object to store in this.stroke.
Method Detail

clone

public java.lang.Object clone()
returns - A copy of this.
Overrides:
clone in class GraphicObject

setLastPoint

public void setLastPoint(java.awt.Point dragPoint)
Description copied from class: GraphicObject
Method setLastPoint is overwritten in PolygonObject, PolylineObject, CurveObject, and CurvedShapeObject.
Overrides:
setLastPoint in class GraphicObject
Parameters:
dragPoint - - The Point object to store as the last of this.shape.

addPoint

public void addPoint(java.awt.Point clickedPoint)
Adds the passed in Point object to the points in this.shape.
Overrides:
addPoint in class GraphicObject
Parameters:
clickedPoint - - The Point object to add to this.shape.

setShape

public void setShape()
Sets this.shape based on the points currently in this.controlPoints.
Overrides:
setShape in class GraphicObject

setControlPoints

public void setControlPoints()
Sets this.controlPoints based on the current PathIterator of this.shape.
Overrides:
setControlPoints in class GraphicObject