

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object  +java.awt.geom.RectangularShape  +java.awt.geom.Ellipse2D  +java.awt.geom.Ellipse2D.Double  +edu.neu.ccs.gui.Oval
Class Oval
extends Ellipse2D.Double
in
order to provide a much shorter name that does not explicitly refer
to an inner class and to add error checking that prevents the width
and height from being set to negative values.
Field Summary 
Fields inherited from class java.awt.geom.Ellipse2D.Double 
height, width, x, y 
Constructor Summary  
Oval()
Constructs a new Oval initialized to location (0, 0)
and size (0, 0). 

Oval(double r,
double s)
Constructs a new Oval initialized to center (0, 0)
and with the given radii: r = halfwidth and s = halfheight. 

Oval(double x,
double y,
double w,
double h)
Constructs and initializes an Oval from the specified
double coordinates. 

Oval(Ellipse2D oval)
Constructs and initializes a Oval from the specified
Ellipse2D object. 

Oval(Rectangle2D rect)
Constructs and initializes an Oval from the specified
Rectangle2D object. 
Method Summary  
void 
setFrame(double x,
double y,
double w,
double h)
Overrides the corresponding inherited method to use the method setXYWH . 
void 
setFrame(Point2D point,
Dimension2D dimension)
Overrides the corresponding inherited method to use the method setXYWH . 
void 
setFrame(Rectangle2D rect)
Overrides the corresponding inherited method to use the method setXYWH . 
void 
setOval(Ellipse2D oval)
Sets the data of this oval from the given oval. 
void 
setX1Y1X2Y2(double x1,
double y1,
double x2,
double y2)
Sets the parameters of the Oval with error checking
using the coordinates of any pair of opposite corners of the frame. 
void 
setXYRS(double x,
double y,
double r,
double s)
Sets the parameters of the Oval with error checking
using the center (x,y) and the inner radii: r = halfwidth and
s = halfheight. 
void 
setXYWH(double x,
double y,
double w,
double h)
Sets the parameters of the Oval with error checking. 
String 
toString()
Returns a String representation of the data
in this Oval . 
Methods inherited from class java.awt.geom.Ellipse2D.Double 
getBounds2D, getHeight, getWidth, getX, getY, isEmpty 
Methods inherited from class java.awt.geom.Ellipse2D 
contains, contains, getPathIterator, intersects 
Methods inherited from class java.awt.geom.RectangularShape 
clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, getPathIterator, intersects, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal 
Methods inherited from class java.lang.Object 
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 
Constructor Detail 
public Oval()
Oval
initialized to location (0, 0)
and size (0, 0).
public Oval(double x, double y, double w, double h)
Oval
from the specified
double coordinates. Calls setXYWH
.
x
 the proposed topleft xcoordinate of the framey
 the proposed topleft ycoordinate of the framew
 the proposed width of the frameh
 the proposed height of the framepublic Oval(double r, double s)
Constructs a new Oval
initialized to center (0, 0)
and with the given radii: r = halfwidth and s = halfheight.
Calls setXYRS
r
 the proposed xradius or halfwidths
 the proposed yradius or halfheightpublic Oval(Rectangle2D rect)
Constructs and initializes an Oval
from the specified
Rectangle2D object. Calls setXYWH
.
Initializes to location (0, 0) and size (0, 0) if the given rect
is null
.
rect
 the Rectangle2D object to use for the framepublic Oval(Ellipse2D oval)
Constructs and initializes a Oval
from the specified
Ellipse2D object. Calls setXYWH
.
Initializes to location (0, 0) and size (0, 0) if the given oval
is null
.
oval
 the Ellipse2D object to copyMethod Detail 
public void setXYWH(double x, double y, double w, double h)
Sets the parameters of the Oval
with error checking.
If the width w is negative, then w is replaced by its absolute value and then x is replaced by (x  w).
If the height h is negative, then h is replaced by its absolute value and then y is replaced by (y  h).
This method guarantees that the internal width and height are always greater than or equal to zero.
x
 the proposed topleft xcoordinate of the framey
 the proposed topleft ycoordinate of the framew
 the proposed width of the frameh
 the proposed height of the framepublic void setXYRS(double x, double y, double r, double s)
Sets the parameters of the Oval
with error checking
using the center (x,y) and the inner radii: r = halfwidth and
s = halfheight.
If the radius r is negative, then r is replaced by its absolute value.
If the radius s is negative, then s is replaced by its absolute value.
This method guarantees that the internal width and height are always greater than or equal to zero.
x
 the proposed center xcoordinatey
 the proposed center ycoordinater
 the proposed xradius or halfwidths
 the proposed yradius or halfheightpublic void setX1Y1X2Y2(double x1, double y1, double x2, double y2)
Sets the parameters of the Oval
with error checking
using the coordinates of any pair of opposite corners of the frame.
x1
 the xcoordinate of one corner of the framey1
 the ycoordinate of one corner of the framex2
 the xcoordinate of the opposite corner of the framey2
 the ycoordinate of the opposite corner of the framepublic void setOval(Ellipse2D oval)
Sets the data of this oval from the given oval.
Does nothing if the given oval is null
.
oval
 the Ellipse2D object to copypublic void setFrame(double x, double y, double w, double h)
Overrides the corresponding inherited method to use the method
setXYWH
.
setFrame
in class Ellipse2D.Double
x
 the proposed topleft xcoordinatey
 the proposed topleft ycoordinatew
 the proposed widthh
 the proposed heightpublic void setFrame(Rectangle2D rect)
Overrides the corresponding inherited method to use the method
setXYWH
.
Does nothing if the given rect is null
.
setFrame
in class RectangularShape
rect
 the Rectangle2D object to copypublic void setFrame(Point2D point, Dimension2D dimension)
Overrides the corresponding inherited method to use the method
setXYWH
.
Does nothing if the given point or dimension is null
.
setFrame
in class RectangularShape
point
 the topleft cornerdimension
 the dimension with the width and heightpublic String toString()
Returns a String
representation of the data
in this Oval
.
The format is similar to that used by Java but simpler:
Oval[x=...,y=...,w=...,h=...]
where (x,y) is the topleft corner of the bounding frame and (w,h) is the dimension of that frame.
toString
in class Object


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 