|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--acm.graphics.GObject | +--acm.graphics.GPolygon
public class GPolygon extends GObject implements GFillable, GScalable
The GPolygon class is a graphical object whose appearance consists of a polygon.
Constructor Summary |
GPolygon() |
GPolygon(double x,
double y) |
GPolygon(GPoint[] points) |
Method Summary | |
void | addArc(double arcWidth,
double arcHeight,
double start,
double sweep) |
void | addEdge(double dx,
double dy) |
void | addPolarEdge(double r,
double theta) |
void | addVertex(double x,
double y) |
boolean | contains(double x,
double y) |
GRectangle | getBounds() |
GPoint | getCurrentPoint() |
Color | getFillColor() |
boolean | isFilled() |
void | recenter() |
void | rotate(double theta) |
void | scale(double sf) |
void | scale(double sx,
double sy) |
void | setFillColor(Color c) |
void | setFilled(boolean fill) |
Inherited Method Summary | |
void | addMouseListener(MouseListener listener) |
void | addMouseMotionListener(MouseMotionListener listener) |
boolean | contains(GPoint pt) |
Color | getColor() |
double | getHeight() |
GPoint | getLocation()GPoint .
|
GDimension | getSize() |
double | getWidth() |
double | getX() |
double | getY() |
boolean | isVisible() |
void | move(double dx, double dy)dx and dy .
|
void | movePolar(double r, double theta) |
void | removeMouseListener(MouseListener listener) |
void | removeMouseMotionListener(MouseMotionListener listener) |
void | sendBackward() |
void | sendForward() |
void | sendToBack() |
void | sendToFront() |
void | setColor(Color color) |
void | setLocation(GPoint pt) |
void | setLocation(double x, double y)x , y ).
|
void | setVisible(boolean visible) |
Constructor Detail |
public GPolygon()
Usage: | GPolygon gpoly = new GPolygon(); |
public GPolygon(double x,
double y)
Usage: | GPolygon gpoly = new GPolygon(x, y); | ||||
Parameters: |
|
public GPolygon(GPoint[] points)
Usage: | GPolygon gpoly = new GPolygon(points); | ||
Parameter: |
|
Method Detail |
public void addArc(double arcWidth,
double arcHeight,
double start,
double sweep)
Usage: | gpoly.addArc(arcWidth, arcHeight, start, sweep); | ||||||||
Parameters: |
|
public void addEdge(double dx,
double dy)
Usage: | gpoly.addEdge(dx, dy); | ||||
Parameters: |
|
public final void addPolarEdge(double r,
double theta)
Usage: | gpoly.addPolarEdge(r, theta); | ||||
Parameters: |
|
public void addVertex(double x,
double y)
Usage: | gpoly.addVertex(x, y); | ||||
Parameters: |
|
public boolean contains(double x,
double y)
Usage: | if (gpoly.contains(x, y)) . . . | ||||
Parameters: |
| ||||
Returns: | true if the point (x, y) is inside the object, and false otherwise |
public GRectangle getBounds()
Usage: | GRectangle bounds = gpoly.getBounds(); |
Returns: | The bounding box for this object |
public GPoint getCurrentPoint()
Usage: | GPoint vertex = gpoly.getCurrentPoint(); |
Returns: | The last vertex added to the polygon, or null if empty |
public Color getFillColor()
Usage: | Color color = gobj.getFillColor(); |
Returns: | The color used to display the filled region of this object |
Specified by: | getFillColor in interface GFillable |
public boolean isFilled()
Usage: | if (gobj.isFilled()) . . . |
Returns: | The color used to display the object |
Specified by: | isFilled in interface GFillable |
public void recenter()
Usage: | gpoly.recenter(); |
public void rotate(double theta)
Usage: | gpoly.rotate(theta); | ||
Parameter: |
|
public final void scale(double sf)
Usage: | gobj.scale(sf); | ||
Parameter: |
| ||
Specified by: | scale in interface GScalable |
public void scale(double sx,
double sy)
Usage: | gpoly.scale(sx, sy); | ||||
Parameters: |
| ||||
Specified by: | scale in interface GScalable |
public void setFillColor(Color c)
Usage: | gobj.setFillColor(color); | ||
Parameter: |
| ||
Specified by: | setFillColor in interface GFillable |
public void setFilled(boolean fill)
Usage: | gobj.setFilled(fill); | ||
Parameter: |
| ||
Specified by: | setFilled in interface GFillable |
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |