Class Oval

public class Oval
implements Shape

An oval class. Ovals are determined by their width and height.

Version:
$Id: Oval.java,v 1.2 2001/04/04 03:25:12 administrator Exp $
Author:
Ben Dugan

Constructor Detail

Oval

public Oval()
Create a green oval.

Oval

public Oval(int x,
            int y,
            int width,
            int height)
Create an unfilled oval bounded by the given dimensions.
Parameters:
x - the x coordinate of the upper left corner
y - the y coordinate of the upper left corner
width - the width of the oval
height - the height of the oval

Oval

public Oval(int x,
            int y,
            int width,
            int height,
            java.awt.Color c,
            boolean fill)
Create a new oval bounded by the given dimensions.
Parameters:
x - the x coordinate of the upper left corner
y - the y coordinate of the upper left corner
width - the width of the oval
height - the height of the oval
c - the color to draw/fill the oval
fill - should it be filled
Method Detail

paint

public void paint(java.awt.Graphics g)
Paint the oval onto the given graphics context.
Specified by:
paint in interface Shape
Overrides:
paint in class ShapeImpl

move

public void move(int deltaX,
                 int deltaY)
Translate the oval by the given offsets.
Specified by:
move in interface Shape
Overrides:
move in class ShapeImpl
Following copied from interface: Shape
Parameters:
deltaX - offset in the X direction.
deltaY - offset in the Y direction.

toString

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

setWindow

public void setWindow(GWindow gw)
Attach the shape to the given window.
Specified by:
setWindow in interface Shape

intersects

public boolean intersects(Shape s)
Does this shape intersect the other shape?
Specified by:
intersects in interface Shape

getBoundingBox

public Rectangle getBoundingBox()
Answer the Rectangle that bounds this shape.
Specified by:
getBoundingBox in interface Shape

getColor

public java.awt.Color getColor()
Answer the color of this shape.
Specified by:
getColor in interface Shape

setColor

public void setColor(java.awt.Color c)
Set the color of this shape.
Specified by:
setColor in interface Shape