uwcse.graphics
Class Polygon

java.lang.Object
  |
  +--uwcse.graphics.ShapeImpl
        |
        +--uwcse.graphics.PolyShape
              |
              +--uwcse.graphics.Polygon
All Implemented Interfaces:
Shape

public class Polygon
extends PolyShape

A polygon shape. A polygon consisting of N vertices will have N sides. The final side is drawn between vertex 0 and N-1. The main operations are to add a new vertex to the polygon (addPoint(...)), to read the x and y coordinates of the upper-left corner and the center of the bounding rectangle around the polygon (getX(), getY(), getCenterX(), and getCenterY()), to change the position of the upper-left corner (moveBy(...) and moveTo(...)), to rotate the polygon around some point (rotateAround(...)), to read and change the color of the polygon (getColor() and setColor(...)), and add to and remove from a GWindow (addTo(...) and removeFromWindow()). Other operations are mainly for internal use, and should not be called by regular client programs.


Constructor Summary
Polygon()
          Create a new orange, filled polygon, initially with no vertices.
Polygon(java.awt.Color c, boolean filled)
          Create a new polygon of the given color and filledness, initially with no vertices.
 
Method Summary
static void main(java.lang.String[] args)
           
 java.lang.String toString()
          Answer the printed representation of this shape.
 
Methods inherited from class uwcse.graphics.PolyShape
addPoint, moveTo, paint, resize, rotateAround
 
Methods inherited from class uwcse.graphics.ShapeImpl
addTo, currentWindow, getBoundingBox, getCenterX, getCenterY, getColor, getHeight, getWidth, getX, getY, intersects, moveBy, recordWindow, removeFromWindow, setColor
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Polygon

public Polygon()
Create a new orange, filled polygon, initially with no vertices.

Polygon

public Polygon(java.awt.Color c,
               boolean filled)
Create a new polygon of the given color and filledness, initially with no vertices.
Parameters:
c - the color of the polygon
filled - should it be filled?
Method Detail

main

public static void main(java.lang.String[] args)

toString

public java.lang.String toString()
Description copied from class: ShapeImpl
Answer the printed representation of this shape.
Overrides:
toString in class PolyShape