Package com.dkt.graphics.elements
Class GOval
- java.lang.Object
-
- com.dkt.graphics.elements.GraphicE
-
- com.dkt.graphics.elements.GFillableE
-
- com.dkt.graphics.elements.GOval
-
- All Implemented Interfaces:
java.lang.Cloneable
public class GOval extends GFillableE
-
-
Constructor Summary
Constructors Constructor Description GOval(int x, int y, int w, int h)
Constructs an oval inscribed in a rectangleGOval(GOval e)
Copy constructorGOval(GRectangle r)
Constructs an oval inscribed in a given rectangle
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GOval
clone()
void
draw(java.awt.Graphics2D g)
Draws the component on the given graphicsboolean
equals(java.lang.Object obj)
java.awt.geom.Area
getShape()
This method should return aArea
that represents theGFillableE
.int
hashCode()
void
traslate(int x, int y)
Traslates this element on X and Y-
Methods inherited from class com.dkt.graphics.elements.GFillableE
fill, getFillPaint, setFill, setFillPaint
-
-
-
-
Constructor Detail
-
GOval
public GOval(GOval e)
Copy constructor- Parameters:
e
-GOval
to copy- Throws:
java.lang.IllegalArgumentException
- ife
isnull
-
GOval
public GOval(GRectangle r) throws java.lang.IllegalArgumentException
Constructs an oval inscribed in a given rectangle- Parameters:
r
- rectangle that will contain the oval- Throws:
java.lang.IllegalArgumentException
- if the rectangle isnull
-
GOval
public GOval(int x, int y, int w, int h) throws InvalidArgumentException
Constructs an oval inscribed in a rectangle- Parameters:
x
- x coordinate of the center of the rectangley
- x coordinate of the center of the rectanglew
- horizontal size of the rectangleh
- vertical size of the rectangle- Throws:
InvalidArgumentException
- if eitherh < 0
orw < 0
-
-
Method Detail
-
draw
public void draw(java.awt.Graphics2D g)
Description copied from class:GraphicE
Draws the component on the given graphics
-
traslate
public void traslate(int x, int y)
Description copied from class:GraphicE
Traslates this element on X and Y
-
clone
public GOval clone()
- Specified by:
clone
in classGFillableE
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classGFillableE
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classGFillableE
-
getShape
public java.awt.geom.Area getShape()
Description copied from class:GFillableE
This method should return aArea
that represents theGFillableE
. Since this is not always possible, and the implementation ofArea
isn't always easy, it should returnnull
otherwise.
InjDrawingLib
s implementation we use the default shapes for this. Note that this method is only called to create clips forGraphic
objects- Specified by:
getShape
in classGFillableE
- Returns:
- Shape
-
-