java.awt.geom

Class RoundRectangle2D.Double

Enclosing Class:
RoundRectangle2D
Implemented Interfaces:
Cloneable, Shape

public static class RoundRectangle2D.Double
extends RoundRectangle2D

The Double class defines a rectangle with rounded corners all specified in double coordinates.

Nested Class Summary

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

RoundRectangle2D.Double, RoundRectangle2D.Float

Field Summary

double
archeight
The height of the arc that rounds off the corners.
double
arcwidth
The width of the arc that rounds off the corners.
double
height
The height of this RoundRectangle2D.
double
width
The width of this RoundRectangle2D.
double
x
The X coordinate of this RoundRectangle2D.
double
y
The Y coordinate of this RoundRectangle2D.

Constructor Summary

Double()
Constructs a new RoundRectangle2D, initialized to location (0.0, 0), size (0.0, 0.0), and corner arcs of radius 0.0.
Double(double x, double y, double w, double h, double arcw, double arch)
Constructs and initializes a RoundRectangle2D from the specified coordinates.

Method Summary

double
getArcHeight()
Returns the height of the arc that rounds off the corners.
double
getArcWidth()
Returns the width of the arc that rounds off the corners.
Rectangle2D
getBounds2D()
Returns the high precision bounding box of this RoundRectangle2D.
double
getHeight()
Returns the height of this RoundRectangle2D in double precision.
double
getWidth()
Returns the width of this RoundRectangle2D in double precision.
double
getX()
Returns the X coordinate of this RoundRectangle2D in double precision.
double
getY()
Returns the Y coordinate of this RoundRectangle2D in double precision.
boolean
isEmpty()
Determines whether or not this RoundRectangle2D is empty.
void
setRoundRect(double x, double y, double w, double h, double arcw, double arch)
Sets the location, size, and arc radii of this RoundRectangle2D to the specified double values.
void
setRoundRect(RoundRectangle2D rr)
Sets this RoundRectangle2D to be the same as the specified RoundRectangle2D.

Methods inherited from class java.awt.geom.RoundRectangle2D

contains, contains, getArcHeight, getArcWidth, getPathIterator, intersects, setFrame, setRoundRect, setRoundRect

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

archeight

public double archeight
The height of the arc that rounds off the corners.

arcwidth

public double arcwidth
The width of the arc that rounds off the corners.

height

public double height
The height of this RoundRectangle2D.

width

public double width
The width of this RoundRectangle2D.

x

public double x
The X coordinate of this RoundRectangle2D.

y

public double y
The Y coordinate of this RoundRectangle2D.

Constructor Details

Double

public Double()
Constructs a new RoundRectangle2D, initialized to location (0.0, 0), size (0.0, 0.0), and corner arcs of radius 0.0.
Usages and Demos :

View More Examples of Double()
   1:         super();
   2:         rect = new RoundRectangle2D.Double();
   3:         arcWidth  = 5.0;
   4:         ...
   5:         super(beadDepth, beadDisplacement, beadOutline, beadFill, beadStroke);
   6:         rect = new RoundRectangle2D.Double();
   7:         this.arcWidth  = arcWidth;
   8:         this.arcHeight = arcHeight;
   9:     }

View Full Code Here
   1:     final Dimension dim = getScaledRoundingDim();
   2:     final RoundRectangle2D shape = new RoundRectangle2D.Double();
   3:     shape.setRoundRect(rec.x, rec.y, rec.width, rec.height, dim.width, dim.height);
   4:     final MfDcState state = file.getCurrentState();

View Full Code Here
   1:         if (roundedRect == null) {
   2:             roundedRect = new RoundRectangle2D.Double();
   3:         }
   4:         return roundedRect;
   5:     }

View Full Code Here
   1:                     case 0 : obj = new GeneralPath(); break;
   2:                     case 1 : obj = new Rectangle2D.Double(); break;
   3:         ...
   4:                     case 2 : obj = new Ellipse2D.Double(); break;
   5:         ...
   6:                     case 3 : obj = new Arc2D.Double(); break;
   7:                     case 4 : obj = new RoundRectangle2D.Double(); break;

View Full Code Here
   1:                     case 0 : obj = new GeneralPath(); break;
   2:                     case 1 : obj = new Rectangle2D.Double(); break;
   3:         ...
   4:                     case 2 : obj = new Ellipse2D.Double(); break;
   5:         ...
   6:                     case 3 : obj = new Arc2D.Double(); break;
   7:                     case 4 : obj = new RoundRectangle2D.Double(); break;

View Full Code Here

Double

public Double(double x,
              double y,
              double w,
              double h,
              double arcw,
              double arch)
Constructs and initializes a RoundRectangle2D from the specified coordinates.
Parameters:
w - the width to which to set the newly constructed RoundRectangle2D
h - the height to which to set the newly constructed RoundRectangle2D
arcw - the width of the arc to use to round off the corners of the newly constructed RoundRectangle2D
arch - the height of the arc to use to round off the corners of the newly constructed RoundRectangle2D
Usages and Demos :

View More Examples of Double(double x,double y,double w,double h,double arcw,double arch)
   1:         g.drawString("RoundRectangle", 10, 20);
   2:         RoundRectangle2D roundRect = new RoundRectangle2D.Double(10, 30, 50, 40, 10, 10);
   3:         g.draw(roundRect);
   4: 
   5:         g.translate(0, 90);

View Full Code Here
   1: 
   2:         RoundRectangle2D rrect = new RoundRectangle2D.Double(10, 30, -10, -8, 2, 2);
   3:         g.draw(rrect);
   4:         ...
   5: 
   6:         rrect = new RoundRectangle2D.Double(30, 30, -10, 0, 2, 2);
   7:         g.draw(rrect);
   8:         ...
   9: 
  10:         rrect = new RoundRectangle2D.Double(50, 30, -10, 8, 2, 2);
  11:         g.draw(rrect);

View Full Code Here
   1:    {  
   2:       RoundRectangle2D s = new RoundRectangle2D.Double(0, 0, 0, 0, 20, 20);
   3:       s.setFrameFromDiagonal(p[0], p[1]);
   4:       return s;
   5:    }

View Full Code Here
   1:             int rectWidth = cornerSize + 1;
   2:             RoundRectangle2D rect = new RoundRectangle2D.Double(0, 0, rectWidth, rectWidth, cornerSize, cornerSize);
   3:             int imageWidth = rectWidth + shadowSize * 2;
   4:             BufferedImage image = new BufferedImage(imageWidth, imageWidth, BufferedImage.TYPE_INT_ARGB);
   5:             Graphics2D buffer = (Graphics2D)image.getGraphics();

View Full Code Here

Method Details

getArcHeight

public double getArcHeight()
Returns the height of the arc that rounds off the corners.
Overrides:
getArcHeight in interface RoundRectangle2D
Returns:
the height of the arc that rounds off the corners of this RoundRectangle2D.

getArcWidth

public double getArcWidth()
Returns the width of the arc that rounds off the corners.
Overrides:
getArcWidth in interface RoundRectangle2D
Returns:
the width of the arc that rounds off the corners of this RoundRectangle2D.

getBounds2D

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

getHeight

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

getWidth

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

getX

public double getX()
Returns the X coordinate of this RoundRectangle2D in double precision.
Overrides:
getX in interface RectangularShape
Returns:
the X coordinate of this RoundRectangle2D.

getY

public double getY()
Returns the Y coordinate of this RoundRectangle2D in double precision.
Overrides:
getY in interface RectangularShape
Returns:
the Y coordinate of this RoundRectangle2D.

isEmpty

public boolean isEmpty()
Determines whether or not this RoundRectangle2D is empty.
Overrides:
isEmpty in interface RectangularShape
Returns:
true if this RoundRectangle2D is empty; false othwerwise.

setRoundRect

public void setRoundRect(double x,
                         double y,
                         double w,
                         double h,
                         double arcw,
                         double arch)
Sets the location, size, and arc radii of this RoundRectangle2D to the specified double values.
Overrides:
setRoundRect in interface RoundRectangle2D
Parameters:
w - the width to which to set this RoundRectangle2D
h - the height to which to set this RoundRectangle2D
arcw - the width to which to set the arc of this RoundRectangle2D
arch - the height to which to set the arc of this RoundRectangle2D

setRoundRect

public void setRoundRect(RoundRectangle2D rr)
Sets this RoundRectangle2D to be the same as the specified RoundRectangle2D.
Overrides:
setRoundRect in interface RoundRectangle2D
Parameters:
rr - the specified RoundRectangle2D