java.awt.geom

Class Ellipse2D.Float

public static class Ellipse2D.Float extends Ellipse2D

An {@link Ellipse2D} that stores its coordinates using float primitives.
Field Summary
floatheight
The height of the ellipse.
floatwidth
The width of the ellipse.
floatx
The upper-left x coordinate of the bounding-box
floaty
The upper-left y coordinate of the bounding-box
Constructor Summary
Float()
Creates a new Ellipse2D with an upper-left coordinate of (0,0) and a zero size.
Float(float x, float y, float w, float h)
Creates a new Ellipse2D within a given rectangle using floating-point precision.

Method Summary
Rectangle2DgetBounds2D()
Returns the bounding-box of the ellipse.
doublegetHeight()
Returns the height of the ellipse.
doublegetWidth()
Returns the width of the ellipse.
doublegetX()
Returns x coordinate of the upper-left corner of the ellipse's bounding-box.
doublegetY()
Returns y coordinate of the upper-left corner of the ellipse's bounding-box.
booleanisEmpty()
Returns true if the ellipse encloses no area, and false otherwise.
voidsetFrame(float x, float y, float w, float h)
Sets the geometry of the ellipse's bounding box.

voidsetFrame(double x, double y, double w, double h)
Sets the geometry of the ellipse's bounding box.

Field Detail

height

public float height
The height of the ellipse.

width

public float width
The width of the ellipse.

x

public float x
The upper-left x coordinate of the bounding-box

y

public float y
The upper-left y coordinate of the bounding-box

Constructor Detail

Float

public Float()
Creates a new Ellipse2D with an upper-left coordinate of (0,0) and a zero size.

Float

public Float(float x, float y, float w, float h)
Creates a new Ellipse2D within a given rectangle using floating-point precision.

Parameters: x - x coordinate of the upper-left of the bounding rectangle y - y coordinate of the upper-left of the bounding rectangle w - width of the ellipse h - height of the ellipse

Method Detail

getBounds2D

public Rectangle2D getBounds2D()
Returns the bounding-box of the ellipse.

Returns: The bounding box.

getHeight

public double getHeight()
Returns the height of the ellipse.

Returns: The height of the ellipse.

getWidth

public double getWidth()
Returns the width of the ellipse.

Returns: The width of the ellipse.

getX

public double getX()
Returns x coordinate of the upper-left corner of the ellipse's bounding-box.

Returns: The x coordinate.

getY

public double getY()
Returns y coordinate of the upper-left corner of the ellipse's bounding-box.

Returns: The y coordinate.

isEmpty

public boolean isEmpty()
Returns true if the ellipse encloses no area, and false otherwise.

Returns: A boolean.

setFrame

public void setFrame(float x, float y, float w, float h)
Sets the geometry of the ellipse's bounding box.

Parameters: x - x coordinate of the upper-left of the bounding rectangle y - y coordinate of the upper-left of the bounding rectangle w - width of the ellipse h - height of the ellipse

setFrame

public void setFrame(double x, double y, double w, double h)
Sets the geometry of the ellipse's bounding box. Note: This leads to a loss of precision.

Parameters: x - x coordinate of the upper-left of the bounding rectangle y - y coordinate of the upper-left of the bounding rectangle w - width of the ellipse h - height of the ellipse