uwcse.graphics
Class Oval

java.lang.Object
  |
  +--uwcse.graphics.ShapeImpl
        |
        +--uwcse.graphics.CurvedShape
              |
              +--uwcse.graphics.Oval
All Implemented Interfaces:
Shape

public class Oval
extends CurvedShape

An oval shape. The dimensions of an oval are described in terms of its bounding rectangle. The main operations are to read the x and y coordinates of the upper-left corner and the center of the bounding rectangle (getX(), getY(), getCenterX(), and getCenterY()), to change the position of the oval (moveBy(...) and moveTo(...)), to rotate the position of the oval around some point (rotateAround(...)), to read and change the color of the oval (getColor() and setColor(...)), to read and change the width and height of the oval (getWidth(), getHeight(), and resize(...)), 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.


Constructor Summary
Oval()
          Create a filled, green oval with a default position and size.
Oval(int x, int y, int width, int height)
          Create an unfilled black oval whose bounding rectangle has the specified upper-left corner and dimensions.
Oval(int x, int y, int width, int height, java.awt.Color c, boolean fill)
          Create an oval of the given color and filledness whose bounding rectangle has the specified upper-left corner and dimensions.
 
Method Summary
 void paint(java.awt.Graphics g)
          Paint this shape onto the given graphics context.
 java.lang.String toString()
          Answer the printed representation of this shape.
 
Methods inherited from class uwcse.graphics.CurvedShape
resize
 
Methods inherited from class uwcse.graphics.ShapeImpl
addTo, currentWindow, getBoundingBox, getCenterX, getCenterY, getColor, getHeight, getWidth, getX, getY, intersects, moveBy, moveTo, recordWindow, removeFromWindow, rotateAround, setColor
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface uwcse.graphics.Shape
addTo, currentWindow, getBoundingBox, getCenterX, getCenterY, getColor, getHeight, getWidth, getX, getY, intersects, moveBy, moveTo, recordWindow, removeFromWindow, rotateAround, setColor
 

Constructor Detail

Oval

public Oval()
Create a filled, green oval with a default position and size.

Oval

public Oval(int x,
            int y,
            int width,
            int height)
Create an unfilled black oval whose bounding rectangle has the specified upper-left corner and dimensions.
Parameters:
x - the x coordinate of the upper left corner of the oval's bounding rectangle
y - the y coordinate of the upper left corner of the oval's bounding rectangle
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 an oval of the given color and filledness whose bounding rectangle has the specified upper-left corner and dimensions.
Parameters:
x - the x coordinate of the upper left corner of the oval's bounding rectangle
y - the y coordinate of the upper left corner of the oval's bounding rectangle
width - the width of the oval
height - the height of the oval
c - the color of the oval
fill - should it be filled?
Method Detail

paint

public void paint(java.awt.Graphics g)
Description copied from interface: Shape
Paint this shape onto the given graphics context. For internal use only.

toString

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