|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectacm.graphics.GObject
acm.graphics.GOval
public class GOval
The GOval class is a graphical object whose appearance consists
of an oval.
| Constructor Summary | |
|---|---|
GOval(double width,
double height)
Constructs a new oval with the specified width and height, positioned at the origin. |
|
GOval(double x,
double y,
double width,
double height)
Constructs a new oval with the specified bounds. |
|
| Method Summary | |
|---|---|
boolean |
contains(double x,
double y)
Checks to see whether a point is inside the object. |
protected Rectangle |
getAWTBounds()
Returns an AWT Rectangle that specifies the bounds of this object. |
GRectangle |
getBounds()
Returns the bounding box of this object. |
Color |
getFillColor()
Returns the color used to display the filled region of this object. |
double |
getHeight()
Returns the height of this object as a double-precision value, which is defined to be the height of the bounding box. |
GDimension |
getSize()
Returns the size of this object as a GDimension. |
double |
getWidth()
Returns the width of this object as a double-precision value, which is defined to be the width of the bounding box. |
boolean |
isFilled()
Returns whether this object is filled. |
void |
paint(Graphics g)
Implements the paint operation for this graphical object. |
void |
scale(double sf)
Scales the object on the screen by the scale factor sf, which applies
in both dimensions. |
void |
scale(double sx,
double sy)
Scales the object on the screen by the scale factors sx and sy. |
void |
setBounds(double x,
double y,
double width,
double height)
Changes the bounds of this object to the specified values. |
void |
setBounds(GRectangle bounds)
Changes the bounds of this object to the values from the specified Rectangle. |
void |
setFillColor(Color color)
Sets the color used to display the filled region of this object. |
void |
setFilled(boolean fill)
Sets whether this object is filled. |
void |
setSize(double width,
double height)
Changes the size of this object to the specified width and height. |
void |
setSize(GDimension size)
Changes the size of this object to the specified GDimension. |
| Methods inherited from class acm.graphics.GObject |
|---|
addActionListener, addMouseListener, addMouseMotionListener, areMouseListenersEnabled, colorName, contains, fireActionEvent, fireActionEvent, fireMouseListeners, getColor, getComponent, getLocation, getObjectColor, getParent, getX, getY, isVisible, move, movePolar, paintObject, paramString, pause, removeActionListener, removeMouseListener, removeMouseMotionListener, repaint, sendBackward, sendForward, sendToBack, sendToFront, setColor, setLocation, setLocation, setParent, setVisible, start, start, toString, updateEnabledList |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public GOval(double width,
double height)
width - The width of the oval in pixelsheight - The height of the oval in pixels
public GOval(double x,
double y,
double width,
double height)
x - The x-coordinate of the upper left cornery - The y-coordinate of the upper left cornerwidth - The width of the oval in pixelsheight - The height of the oval in pixels| Method Detail |
|---|
public boolean contains(double x,
double y)
contains in class GObjectx - The x-coordinate of the point being testedy - The y-coordinate of the point being tested
true if the point (x, y) is inside
the object, and false otherwiseprotected Rectangle getAWTBounds()
Rectangle that specifies the bounds of this object.
Rectangle that specifies the bounds of this objectpublic GRectangle getBounds()
getBounds in class GObjectpublic Color getFillColor()
getFillColor returns the color of the
object.
getFillColor in interface GFillablepublic double getHeight()
getHeight in class GObjectpublic GDimension getSize()
GDimension.
getSize in class GObjectpublic double getWidth()
getWidth in class GObjectpublic boolean isFilled()
isFilled in interface GFillablepublic void paint(Graphics g)
paint operation for this graphical object. This method
is not called directly by clients.
paint in class GObjectg - The graphics context into which the painting is donepublic final void scale(double sf)
sf, which applies
in both dimensions.
scale in interface GScalablesf - The factor used to scale all coordinates in both dimensions
public void scale(double sx,
double sy)
sx and sy.
scale in interface GScalablesx - The factor used to scale all coordinates in the x directionsy - The factor used to scale all coordinates in the y direction
public void setBounds(double x,
double y,
double width,
double height)
setBounds in interface GResizablex - The new x-coordinate for the objecty - The new y-coordinate for the objectwidth - The new width of the objectheight - The new height of the objectpublic final void setBounds(GRectangle bounds)
Rectangle.
setBounds in interface GResizablebounds - A GRectangle specifying the new boundspublic void setFillColor(Color color)
setFillColor in interface GFillablecolor - The color used to display the filled region of this objectpublic void setFilled(boolean fill)
setFilled in interface GFillablefill - true if the object should be filled, false for an outline
public void setSize(double width,
double height)
setSize in interface GResizablewidth - The new width of the objectheight - The new height of the objectpublic final void setSize(GDimension size)
GDimension.
setSize in interface GResizablesize - A GDimension object specifying the size
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||