|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcse115.graphics.AbstractGraphic
cse115.graphics.AbstractColorableGraphic
cse115.graphics.Polygon
public class Polygon
A polygon is a Graphic that can form many shapes. To use, set the desired dimension of the polygon. Then add at least three points in order to correctly make a polygon. This will play connect the dots in the order that the points are added. Then connects the last point back to the first, forming a polygon.
| Constructor Summary | |
|---|---|
Polygon()
Creates a new instance of Polygon with no vertices |
|
| Method Summary | |
|---|---|
void |
actualPaint(Graphics2D gs,
Point location,
Dimension dimension)
This method uses the Graphics2D object to paint the Polygon onto the container. |
void |
addPoint(Point p)
Add a point to the polygon |
Point |
getLocation()
Returns the location of the polygon |
Shape |
getShape()
Gets a java.awt.shape that represents this shape |
void |
move(Vector v)
Moves the Polygon by some amount, specified by a vector |
void |
removePoint(Point p)
removes the first occurrence of point p from the polygon |
void |
setDimension(Dimension d)
Resizes the Polygon to a specific dimension. |
void |
setLocation(Point point)
Sets the location of the polygon. |
| Methods inherited from class cse115.graphics.AbstractColorableGraphic |
|---|
getColor, paint, setColor |
| Methods inherited from class cse115.graphics.AbstractGraphic |
|---|
addMouseListener, addMouseMotionListener, contains, getBounds, getCenterLocation, getContainer, getDimension, getMouseListeners, getMouseMotionListeners, getRotation, intersects, rotate, setCenterLocation, setContainer, setRotation |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface cse115.graphics.Graphic |
|---|
addMouseListener, addMouseMotionListener, contains, getBounds, getMouseListeners, getMouseMotionListeners, intersects, setContainer |
| Methods inherited from interface cse115.graphics.Sizeable |
|---|
getDimension |
| Methods inherited from interface cse115.graphics.CenterLocatable |
|---|
getCenterLocation, setCenterLocation |
| Methods inherited from interface cse115.graphics.Rotatable |
|---|
getRotation, rotate, setRotation |
| Constructor Detail |
|---|
public Polygon()
| Method Detail |
|---|
public void addPoint(Point p)
p - the point to addpublic void removePoint(Point p)
p - The Point to remove
public void actualPaint(Graphics2D gs,
Point location,
Dimension dimension)
gs - The Graphics2D object to do the paintinglocation - Does nothingdimension - Does NothingGraphic.actualPaint(java.awt.Graphics2D,
java.awt.Point, java.awt.Dimension)public void setLocation(Point point)
setLocation in interface LocatablesetLocation in class AbstractGraphicpoint - A java.awt.Point representing the new location of the PolygonLocatable.setLocation(java.awt.Point)public Point getLocation()
getLocation in interface LocatablegetLocation in class AbstractGraphicAbstractGraphic.getLocation()public void move(Vector v)
move in interface Locatablemove in class AbstractGraphicv - The vector representing the amount to move the PolygonLocatable.move(cse115.utilities.Vector)public void setDimension(Dimension d)
setDimension in interface SizeablesetDimension in class AbstractGraphicd - The dimension which the polygon should haveSizeable.setDimension(java.awt.Dimension)public Shape getShape()
Graphic.getShape()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||