Class Ellipse

java.lang.Object
  extended by Ellipse
All Implemented Interfaces:
Shape

public class Ellipse
extends Object
implements Shape


Constructor Summary
Ellipse(double x, double y, double width, double height)
          Constructs an ellipse.
 
Method Summary
 void draw()
          Draws this ellipse.
 void fill()
          Fills this ellipse.
 int getHeight()
          Gets the height of the bounding box.
 int getWidth()
          Gets the width of the bounding box.
 int getX()
          Gets the leftmost x-position of this ellipse.
 int getY()
          Gets the topmost y-position of this ellipse.
 void grow(double dw, double dh)
          Resizes this ellipse both horizontally and vertically.
 void paintShape(Graphics2D g2)
          Paints the shape
 void setColor(Color newColor)
          Sets the color of this ellipse.
 String toString()
           
 void translate(double dx, double dy)
          Moves this ellipse by a given amount.
 
Methods inherited from class
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Ellipse

public Ellipse(double x,
               double y,
               double width,
               double height)
Constructs an ellipse.

Parameters:
x - the leftmost x-coordinate
y - the topmost y-coordinate
width - the width of the bounding box
height - the height of the bounding box
Method Detail

draw

public void draw()
Draws this ellipse.


fill

public void fill()
Fills this ellipse.


getHeight

public int getHeight()
Gets the height of the bounding box.

Specified by:
getHeight in interface Shape
Returns:
the height

getWidth

public int getWidth()
Gets the width of the bounding box.

Specified by:
getWidth in interface Shape
Returns:
the width

getX

public int getX()
Gets the leftmost x-position of this ellipse.

Specified by:
getX in interface Shape
Returns:
the leftmost x-position

getY

public int getY()
Gets the topmost y-position of this ellipse.

Specified by:
getY in interface Shape
Returns:
the topmost y-position

grow

public void grow(double dw,
                 double dh)
Resizes this ellipse both horizontally and vertically.

Parameters:
dw - the amount by which to resize the width on each side
dw - the amount by which to resize the height on each side

paintShape

public void paintShape(Graphics2D g2)
Description copied from interface: Shape
Paints the shape

Specified by:
paintShape in interface Shape
Parameters:
g2 - the graphics object

setColor

public void setColor(Color newColor)
Sets the color of this ellipse.

Parameters:
newColor - the new color

toString

public String toString()
Overrides:
toString in class Object

translate

public void translate(double dx,
                      double dy)
Moves this ellipse by a given amount.

Parameters:
dx - the amount by which to move in x-direction
dy - the amount by which to move in y-direction