|
||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
All shapes implement this interface. The main operations are to read the x and y coordinates of the upper-left corner and the center of the shape (getX(), getY(), getCenterX(), and getCenterY()), to change the position of the shape (moveBy(...) and moveTo(...)), to rotate the position of the shape around some point (rotateAround(...)), to read and change the color of the shape (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.
Method Summary | |
void |
addTo(GWindow gw)
Add the shape to the given graphics window, if non-null. |
uwcse.graphics.InternalGWindow |
currentWindow()
Return the window this shape is currently displayed on, or null if not displayed on any window. |
Rectangle |
getBoundingBox()
Return the shape's bounding box (the smallest rectangle enclosing the shape). |
int |
getCenterX()
Return the X coordinate of the shape's center |
int |
getCenterY()
Return the Y coordinate of the shape's center |
java.awt.Color |
getColor()
Answer the color of this shape. |
int |
getHeight()
Return the height of the shape's bounding box (the smallest rectangle enclosing the shape). |
int |
getWidth()
Return the width of the shape's bounding box (the smallest rectangle enclosing the shape). |
int |
getX()
Return the X coordinate of the shape's upper-left corner |
int |
getY()
Return the Y coordinate of the shape's upper-left corner |
boolean |
intersects(Shape other)
Return whether this shape's bounding box intersects with the argument shape's bounding box. |
void |
moveBy(int deltaX,
int deltaY)
Change this shape's position. |
void |
moveTo(int x,
int y)
Change this shape's position. |
void |
paint(java.awt.Graphics g)
Paint this shape onto the given graphics context. |
void |
recordWindow(uwcse.graphics.InternalGWindow gw)
Tell the shape that it belongs to the given window. |
void |
removeFromWindow()
Remove the shape from its graphics window, if it is added to one. |
void |
rotateAround(int pivotX,
int pivotY,
double degrees)
Rotate the shape around the argument coordinates by the given number of degrees, counter-clockwise. |
void |
setColor(java.awt.Color c)
Set the color of this shape. |
Method Detail |
public void addTo(GWindow gw)
gw
- the graphics window to add the shape topublic uwcse.graphics.InternalGWindow currentWindow()
public Rectangle getBoundingBox()
public int getCenterX()
public int getCenterY()
public java.awt.Color getColor()
public int getHeight()
public int getWidth()
public int getX()
public int getY()
public boolean intersects(Shape other)
public void moveBy(int deltaX, int deltaY)
deltaX
- offset in the X directiondeltaY
- offset in the Y directionpublic void moveTo(int x, int y)
x
- new X coordinatey
- new Y coordinatepublic void paint(java.awt.Graphics g)
public void recordWindow(uwcse.graphics.InternalGWindow gw)
public void removeFromWindow()
public void rotateAround(int pivotX, int pivotY, double degrees)
pivotX
- the X coordinate of the point around which to
rotate the shapepivotY
- the Y coordinate of the point around which to
rotate the shapedegrees
- the angle to rotate by counter-clockwise, in degreespublic void setColor(java.awt.Color c)
c
- the new color of the shape
|
||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |