|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gishur.gui2.EllipseShape
An ellipse which implements the Shape
interface.
Field Summary | |
int |
height
The height of the oval's bounding box. |
int |
width
The width of the oval's bounding box. |
int |
x
The x coordinate of the oval's bounding box. |
int |
y
The y coordinate of the oval's bounding box. |
Constructor Summary | |
EllipseShape()
Constructs a new EllipseShape, initialized to location (0,0) and size (0,0) . |
|
EllipseShape(int x,
int y,
int w,
int h)
Constructs and initializes an EllipseShape from the specified coordinates. |
Method Summary | |
java.lang.Object |
clone()
Creates a new object of the same class as this object. |
boolean |
contains(int x,
int y)
Tests if a specified point is inside the boundary of this EllipseShape. |
boolean |
contains(int x,
int y,
int w,
int h)
Tests if the interior of this EllipseShape entirely
contains the specified rectangular area. |
boolean |
contains(java.awt.Point p)
Tests if a specified Point is inside the boundary
of the EllipseShape. |
void |
draw(java.awt.Graphics g)
Strokes the outline of a Shape using the settings of the
Graphics context (if visible). |
void |
fill(java.awt.Graphics g)
Fills the interior of a Shape using the settings of the
Graphics context (if visible). |
java.awt.Rectangle |
getBounds()
Returns the bounding box of this EllipseShape. |
RectangleShape |
getBoundShape()
Return the bounding box of the EllipseShape. |
java.awt.Point |
getCenter()
Returns the center point of the framing rectangle of the EllipseShape. |
int |
getCenterX()
Returns the X coordinate of the center of the framing rectangle of the EllipseShape. |
int |
getCenterY()
Returns the Y coordinate of the center of the framing rectangle of the Shape . |
int |
getHeight()
Returns the overall height of this EllipseShape. |
int |
getWidth()
Returns the overall width of this EllipseShape. |
int |
getX()
Returns the X coordinate of the upper left corner of this EllipseShape. |
int |
getY()
Returns the Y coordinate of the upper left corner of this EllipseShape. |
boolean |
intersects(int x,
int y,
int w,
int h)
Tests if the interior of this EllipseShape intersects
the interior of a specified rectangular area. |
boolean |
isEmpty()
Determines whether or not the bounding box of this
EllipseShape is empty. |
void |
set(int x,
int y,
int width,
int height)
Sets the EllipseShape to the specified values. |
void |
setFrame(int x,
int y,
int w,
int h)
Sets the location and size of this EllipseShape to
the specified values. |
void |
setLocation(int x,
int y)
Moves the this Shape to the specified location. |
java.lang.String |
toString()
Returns a string representation of the object. |
void |
translate(int dx,
int dy)
Translates this EllipseShape by the vector (x,y) . |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.awt.Shape |
contains, contains, contains, contains, getBounds2D, getPathIterator, getPathIterator, intersects, intersects |
Field Detail |
public int x
public int y
public int width
public int height
Constructor Detail |
public EllipseShape()
(0,0)
and size (0,0)
.public EllipseShape(int x, int y, int w, int h)
x,y
- the coordinates of the bounding rectanglew
- the width of the bounding rectangleh
- the height of the bounding rectangleMethod Detail |
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object clone()
clone
in interface Cloneable
clone
in class java.lang.Object
OutOfMemoryError
- if there is not enough memory.Cloneable
public int getX()
this
EllipseShape.public int getY()
this
EllipseShape.public int getWidth()
this
EllipseShape.this
EllipseShape.public int getHeight()
this
EllipseShape.this
EllipseShape.public void setFrame(int x, int y, int w, int h)
this
EllipseShape to
the specified values.x, y
- the specified coordinates to which to set
the location of the bounding boxw
- the specified width to which to set the width of
this
EllipseShapeh
- the specified height to which to set the height of
the EllipseShapepublic boolean isEmpty()
this
EllipseShape is empty.true
if the bounding rectangle of
this
EllipseShape is empty; false
otherwise.public boolean contains(int x, int y)
this
EllipseShape.contains
in interface Shape
x, y
- the coordinates to testtrue
if the specified point is contained
in this ellipse; false
otherwise.public boolean contains(java.awt.Point p)
Point
is inside the boundary
of the EllipseShape.contains
in interface Shape
p
- a specified pointtrue
if the specified point is
inside the boundary of the Shape
;
false
otherwise.public boolean intersects(int x, int y, int w, int h)
this
EllipseShape intersects
the interior of a specified rectangular area.intersects
in interface Shape
x, y
- the coordinates of the upper left corner of the
specified rectangular areaw
- the width of the specified rectangular areah
- the height of the specified rectangluar areatrue
if this
EllipseShape contains
the specified rectangular area; false
otherwise.public boolean contains(int x, int y, int w, int h)
this
EllipseShape entirely
contains the specified rectangular area.contains
in interface Shape
x, y
- the coordinates of the upper left corner of the
specified rectangular areaw
- the width of the specified rectangular areah
- the height of the specified rectangular areatrue
if this
EllipseShape contains
the specified rectangular area; false
otherwise.public java.awt.Rectangle getBounds()
this
EllipseShape.getBounds
in interface java.awt.Shape
Rectangle
that is the bounding box
of this
EllipseShape.public RectangleShape getBoundShape()
getBoundShape
in interface Shape
public int getCenterX()
getCenterX
in interface Shape
public int getCenterY()
Shape
.getCenterY
in interface Shape
public java.awt.Point getCenter()
getCenter
in interface Shape
public void translate(int dx, int dy)
this
EllipseShape by the vector (x,y)
.translate
in interface Shape
dx
- x coordinate of the translation vectordy
- y coordinate of the translation vectorpublic void setLocation(int x, int y)
this
Shape to the specified location.setLocation
in interface Shape
dx
- x coordinate of point to move tody
- y coordinate of point to move topublic void set(int x, int y, int width, int height)
EllipseShape
to the specified values.x,y
- new position of the upper left corner of the
bounding rectanglewidth
- new width of the bounding rectangleheight
- new height of the bounding rectanglepublic void draw(java.awt.Graphics g)
Shape
using the settings of the
Graphics
context (if visible).draw
in interface Shape
g
- Graphics contextpublic void fill(java.awt.Graphics g)
Shape
using the settings of the
Graphics
context (if visible).fill
in interface Shape
g
- Graphics context
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |