|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object acm.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 pixelspublic 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 pixelsMethod Detail |
---|
public boolean contains(double x, double y)
contains
in class GObject
x
- 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 GObject
public Color getFillColor()
getFillColor
returns the color of the
object.
getFillColor
in interface GFillable
public double getHeight()
getHeight
in class GObject
public GDimension getSize()
GDimension
.
getSize
in class GObject
public double getWidth()
getWidth
in class GObject
public boolean isFilled()
isFilled
in interface GFillable
public void paint(Graphics g)
paint
operation for this graphical object. This method
is not called directly by clients.
paint
in class GObject
g
- The graphics context into which the painting is donepublic final void scale(double sf)
sf
, which applies
in both dimensions.
scale
in interface GScalable
sf
- The factor used to scale all coordinates in both dimensionspublic void scale(double sx, double sy)
sx
and sy
.
scale
in interface GScalable
sx
- The factor used to scale all coordinates in the x directionsy
- The factor used to scale all coordinates in the y directionpublic void setBounds(double x, double y, double width, double height)
setBounds
in interface GResizable
x
- 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 GResizable
bounds
- A GRectangle
specifying the new boundspublic void setFillColor(Color color)
setFillColor
in interface GFillable
color
- The color used to display the filled region of this objectpublic void setFilled(boolean fill)
setFilled
in interface GFillable
fill
- true
if the object should be filled, false
for an outlinepublic void setSize(double width, double height)
setSize
in interface GResizable
width
- The new width of the objectheight
- The new height of the objectpublic final void setSize(GDimension size)
GDimension
.
setSize
in interface GResizable
size
- A GDimension
object specifying the size
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |