|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectm865.shapepack.Shape
m865.shapepack.Ellipse
public class Ellipse
The concrete Shape subclass that defines ellipses.
Field Summary |
---|
Fields inherited from class m865.shapepack.Shape |
---|
color, defaultColor, defaultHeight, defaultWidth, height, width, x, y |
Constructor Summary | |
---|---|
Ellipse(int x,
int y)
Constructor for an ellipse at the specified location with the default width, height, and color. |
|
Ellipse(int x,
int y,
int w,
int h,
java.awt.Color c)
/** The generic Ellipse constructor |
Method Summary | |
---|---|
float |
area()
Calculates the area of the ellipse. |
void |
draw(java.awt.Graphics g)
Draws the ellipse. |
float |
perimeter()
Calculates an approximation to the perimeter of the ellipse. |
java.lang.String |
toString()
Generates a string describing the parameters of the shape. |
Methods inherited from class m865.shapepack.Shape |
---|
getColor, getHeight, getWidth, getX, getY, moveTo, setColor, setHeight, setWidth |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Ellipse(int x, int y, int w, int h, java.awt.Color c)
x
- horizontal coordinate of the upper left corner of the bounding box.y
- vertical coordinate of the upper left corner of the bounding box.w
- the length of the horizontal axis of the ellipse.h
- the length of the vertical axis of the ellipse.c
- fill color for the ellipse.public Ellipse(int x, int y)
x
- horizontal coordinate of the upper left corner of the bounding box.y
- vertical coordinate of the upper left corner of the bounding box.Method Detail |
---|
public void draw(java.awt.Graphics g)
draw
in class Shape
g
- the graphics object on which the shape is to be drawn.public float area()
area
in class Shape
public float perimeter()
perimeter
in class Shape
public java.lang.String toString()
Shape
toString
in class Shape
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |