java.awt.geom

Class Ellipse2D.Float

Enclosing Class:
Ellipse2D
Implemented Interfaces:
Cloneable, Shape

public static class Ellipse2D.Float
extends Ellipse2D

The Float class defines an ellipse specified in float precision.

Nested Class Summary

Nested classes/interfaces inherited from class java.awt.geom.Ellipse2D

Ellipse2D.Double, Ellipse2D.Float

Field Summary

float
height
The overall height of this Ellipse2D.
float
width
The overall width of this Ellipse2D.
float
x
The x coordinate of the upper left corner of this Ellipse2D.
float
y
The y coordinate of the upper left corner of this Ellipse2D.

Constructor Summary

Float()
Constructs a new Ellipse2D, initialized to location (0, 0) and size (0, 0).
Float(float x, float y, float w, float h)
Constructs and initializes an Ellipse2D from the specified coordinates.

Method Summary

Rectangle2D
getBounds2D()
Returns the high precision bounding box of this Ellipse2D.
double
getHeight()
Returns the overall height of this Ellipse2D in double precision.
double
getWidth()
Returns the overall width of this Ellipse2D in double precision.
double
getX()
Returns the X coordinate of the upper left corner of this Ellipse2D in double precision.
double
getY()
Returns the Y coordinate of the upper left corner of this Ellipse2D in double precision.
boolean
isEmpty()
Determines whether or not the bounding box of this Ellipse2D is empty.
void
setFrame(double x, double y, double w, double h)
Sets the location and size of this Ellipse2D to the specified double values.
void
setFrame(float x, float y, float w, float h)
Sets the location and size of this Ellipse2D to the specified float values.

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, getHeight, getMaxX, getMaxY, getMinX, getMinY, getPathIterator, getWidth, getX, getY, intersects, isEmpty, setFrame, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

height

public float height
The overall height of this Ellipse2D.

width

public float width
The overall width of this Ellipse2D.

x

public float x
The x coordinate of the upper left corner of this Ellipse2D.

y

public float y
The y coordinate of the upper left corner of this Ellipse2D.

Constructor Details

Float

public Float()
Constructs a new Ellipse2D, initialized to location (0, 0) and size (0, 0).
Usages and Demos :

View More Examples of Float()
   1:     public void testRectangles() {
   2:         Rectangle2D.Float rect = new Rectangle2D.Float();
   3:         for (int i = 0; i < 100; i++) {
   4:         ...
   5:     public void testEllipses() {
   6:         Ellipse2D.Float ell = new Ellipse2D.Float();
   7: 
   8:         for (int i = 0; i < 100; i++) {
   9:             ell.x = random(min, max);

View Full Code Here
   1:         for (int i = 0; i < ellipses.length; i++) {
   2:             ellipses[i] = new Ellipse2D.Float();
   3:             getRandomXY(i, 20 * Math.random(), 200, 200);
   4:         }
   5:     }

View Full Code Here
   1:         
   2:         private final Ellipse2D.Float ellipse = new Ellipse2D.Float();
   3:         
   4:         public Node(EventType type, KUID nodeId, OpCode opcode, boolean request) {
   5:             this.type = type;

View Full Code Here
   1:       case WHEEL           :
   2:       case ELLIPSE         : style.displayObject = new Ellipse2D.Float(); break;
   3:         ...
   4:       case RECTANGLE       : style.displayObject = new Rectangle2D.Float(); break;
   5:         ...
   6:       case ROUND_RECTANGLE : style.displayObject = new RoundRectangle2D.Float(); break;
   7:     }

View Full Code Here
   1:     private BasicStroke bs = new BasicStroke(20.0f);
   2:     private Arc2D arc = new Arc2D.Float();
   3:         ...
   4:     private Ellipse2D ellipse = new Ellipse2D.Float();
   5:         ...
   6:     private RoundRectangle2D roundRect = new RoundRectangle2D.Float();
   7:     private Rectangle2D rect = new Rectangle2D.Float();

View Full Code Here

Float

public Float(float x,
             float y,
             float w,
             float h)
Constructs and initializes an Ellipse2D from the specified coordinates.
Parameters:
w - the width of the bounding rectangle
h - the height of the bounding rectangle
Usages and Demos :

View More Examples of Float(float x,float y,float w,float h)
   1:   {
   2:     return new Ellipse2D.Float(0, 0, 100, 100);
   3:   }
   4: }

View Full Code Here
   1:     Shape oldClip = g2.getClip();
   2:     Shape e = new Ellipse2D.Float(-cx, -cy, cx * 2, cy * 2);
   3:     g2.clip(e);
   4:         ...
   5: 
   6:     Shape c = new Ellipse2D.Float(-cx, -cy, cx * 3 / 4, cy * 2);
   7:     g2.setPaint(new GradientPaint(40, 40, Color.blue,
   8:         60, 50, Color.white, true));
   9:     g2.fill(c);

View Full Code Here
   1:     {
   2:       elementFactory.setShape(new Ellipse2D.Float(0, 0, 100, 100));
   3:     }
   4:     else
   5:     {

View Full Code Here
   1:         float eh = size-20;
   2:         Ellipse2D ellipse = new Ellipse2D.Float(-ew/2, -eh/2, ew, eh);
   3:         for (double angdeg = 0; angdeg < 360; angdeg+=increment) {
   4:             if (angdeg % emphasis == 0) {
   5:                 g2.setColor(Color.gray);

View Full Code Here
   1:     g.translate(COVERWIDTH+10, 0);
   2:     Area clip = new Area(new Ellipse2D.Float(0,0,COVERWIDTH,COVERHEIGHT));
   3:     clip.intersect(new Area(new Rectangle(5,5,
   4:                           COVERWIDTH-10,COVERHEIGHT-10)));
   5:     clip.subtract(new Area(new Ellipse2D.Float(COVERWIDTH/2-40,

View Full Code Here

Method Details

getBounds2D

public Rectangle2D getBounds2D()
Returns the high precision bounding box of this Ellipse2D.
Specified by:
getBounds2D in interface Shape
Returns:
a Rectangle2D that is the bounding box of this Ellipse2D.

getHeight

public double getHeight()
Returns the overall height of this Ellipse2D in double precision.
Overrides:
getHeight in interface RectangularShape
Returns:
the height of this Ellipse2D.

getWidth

public double getWidth()
Returns the overall width of this Ellipse2D in double precision.
Overrides:
getWidth in interface RectangularShape
Returns:
the width of this Ellipse2D.

getX

public double getX()
Returns the X coordinate of the upper left corner of this Ellipse2D in double precision.
Overrides:
getX in interface RectangularShape
Returns:
the X coordinate of the upper left corner of the bounding rectangle of this Ellipse2D.

getY

public double getY()
Returns the Y coordinate of the upper left corner of this Ellipse2D in double precision.
Overrides:
getY in interface RectangularShape
Returns:
the Y coordinate of the upper left corner of the bounding rectangle of this Ellipse2D.

isEmpty

public boolean isEmpty()
Determines whether or not the bounding box of this Ellipse2D is empty.
Overrides:
isEmpty in interface RectangularShape
Returns:
true if the bounding rectangle of this Ellipse2D is empty; false otherwise.

setFrame

public void setFrame(double x,
                     double y,
                     double w,
                     double h)
Sets the location and size of this Ellipse2D to the specified double values.
Overrides:
setFrame in interface RectangularShape
Parameters:
w - the specified width to which to set the width of this Ellipse2D
h - the specified height to which to set the height of this Ellipse2D

setFrame

public void setFrame(float x,
                     float y,
                     float w,
                     float h)
Sets the location and size of this Ellipse2D to the specified float values.
Parameters:
w - the specified width to which to set the width of this Ellipse2D
h - the specified height to which to set the height of the Ellipse2D