Top Description Fields Constructors Methods
com.sun.javafx.geom

public Class RoundRectangle2D

extends RectangularShape
Class Inheritance
Imports
com.sun.javafx.geom.transform.BaseTransform

The RoundRectangle2D class defines a rectangle with rounded corners defined by a location (x,y), a dimension (w x h), and the width and height of an arc with which to round the corners.
Version
1.29, 05/05/07

Field Summary

Modifier and TypeField and Description
public float
arcHeight

The height of the arc that rounds off the corners.

public float
arcWidth

The width of the arc that rounds off the corners.

public float
height

The height of this RoundRectangle2D.

public float
width

The width of this RoundRectangle2D.

public float
x

The X coordinate of this RoundRectangle2D.

public float
y

The Y coordinate of this RoundRectangle2D.

Constructor Summary

AccessConstructor and Description
public
RoundRectangle2D()

Constructs a new RoundRectangle2D, initialized to location (0.0, 0.0), size (0.0, 0.0), and corner arcs of radius 0.0.

public
RoundRectangle2D(float
the X coordinate of the newly constructed RoundRectangle2D
x
,
float
the Y coordinate of the newly constructed RoundRectangle2D
y
,
float
the width to which to set the newly constructed RoundRectangle2D
w
,
float
the height to which to set the newly constructed RoundRectangle2D
h
,
float
the width of the arc to use to round off the corners of the newly constructed RoundRectangle2D
arcw
,
float
the height of the arc to use to round off the corners of the newly constructed RoundRectangle2D
arch
)

Constructs and initializes a RoundRectangle2D from the specified float coordinates.

Method Summary

Modifier and TypeMethod and Description
private int
classify(float coord, float left, float right, float arcsize)

public boolean
contains(float
the specified X coordinate to be tested
x
,
float
the specified Y coordinate to be tested
y
)

Implements abstract com.sun.javafx.geom.Shape.contains.

Tests if the specified coordinates are inside the boundary of the Shape.

public boolean
contains(float
the X coordinate of the upper-left corner of the specified rectangular area
x
,
float
the Y coordinate of the upper-left corner of the specified rectangular area
y
,
float
the width of the specified rectangular area
w
,
float
the height of the specified rectangular area
h
)

Implements abstract com.sun.javafx.geom.Shape.contains.

Tests if the interior of the Shape entirely contains the specified rectangular area.

public RoundRectangle2D
copy()

Implements abstract com.sun.javafx.geom.Shape.copy.

Returns a new copy of this Shape instance.

public boolean

Returns:

true if obj is an instance of RoundRectangle2D and has the same values; false otherwise.
equals
(Object
an Object to be compared with this RoundRectangle2D.
obj
)

Overrides java.lang.Object.equals.

Determines whether or not the specified Object is equal to this RoundRectangle2D.

public RectBounds
getBounds()

Overrides com.sun.javafx.geom.RectangularShape.getBounds.

Note that there is no guarantee that the returned RectBounds is the smallest bounding box that encloses the Shape, only that the Shape lies entirely within the indicated RectBounds.

public float
getHeight()

Implements abstract com.sun.javafx.geom.RectangularShape.getHeight.

Returns the height of the framing rectangle in double precision.

public PathIterator

Returns:

the PathIterator object that returns the geometry of the outline of this RoundRectangle2D, one segment at a time.
getPathIterator
(BaseTransform
an optional BaseTransform to be applied to the coordinates as they are returned in the iteration, or null if untransformed coordinates are desired
tx
)

Implements abstract com.sun.javafx.geom.Shape.getPathIterator.

Returns an iteration object that defines the boundary of this RoundRectangle2D.

public float
getWidth()

Implements abstract com.sun.javafx.geom.RectangularShape.getWidth.

Returns the width of the framing rectangle in double precision.

public float
getX()

Implements abstract com.sun.javafx.geom.RectangularShape.getX.

Returns the X coordinate of the upper-left corner of the framing rectangle in double precision.

public float
getY()

Implements abstract com.sun.javafx.geom.RectangularShape.getY.

Returns the Y coordinate of the upper-left corner of the framing rectangle in double precision.

public int

Returns:

the hashcode for this RoundRectangle2D.
hashCode
()

Overrides java.lang.Object.hashCode.

Returns the hashcode for this RoundRectangle2D.

public boolean
intersects(float
the X coordinate of the upper-left corner of the specified rectangular area
x
,
float
the Y coordinate of the upper-left corner of the specified rectangular area
y
,
float
the width of the specified rectangular area
w
,
float
the height of the specified rectangular area
h
)

Implements abstract com.sun.javafx.geom.Shape.intersects.

Tests if the interior of the Shape intersects the interior of a specified rectangular area.

public boolean
isEmpty()

Implements abstract com.sun.javafx.geom.RectangularShape.isEmpty.

Determines whether the RectangularShape is empty.

public void
setFrame(float
the X coordinate of the upper-left corner of the specified rectangular shape
x
,
float
the Y coordinate of the upper-left corner of the specified rectangular shape
y
,
float
the width of the specified rectangular shape
w
,
float
the height of the specified rectangular shape
h
)

Implements abstract com.sun.javafx.geom.RectangularShape.setFrame.

Sets the location and size of the framing rectangle of this Shape to the specified rectangular values.

public void
setRoundRect(float
the X coordinate to which to set the location of this RoundRectangle2D
x
,
float
the Y coordinate to which to set the location of this RoundRectangle2D
y
,
float
the width to which to set this RoundRectangle2D
w
,
float
the height to which to set this RoundRectangle2D
h
,
float
the width to which to set the arc of this RoundRectangle2D
arcw
,
float
the height to which to set the arc of this RoundRectangle2D
arch
)

Sets the location, size, and corner radii of this RoundRectangle2D to the specified float values.

public void
setRoundRect(RoundRectangle2D
the specified RoundRectangle2D
rr
)

Sets this RoundRectangle2D to be the same as the specified RoundRectangle2D.

Inherited from com.sun.javafx.geom.RectangularShape:
containsgetCenterXgetCenterYgetMaxXgetMaxYgetMinXgetMinYgetPathIteratorsetFramesetFrameFromCentersetFrameFromCentersetFrameFromDiagonalsetFrameFromDiagonaltoString

Field Detail

arcHeightback to summary
public float arcHeight

The height of the arc that rounds off the corners.

arcWidthback to summary
public float arcWidth

The width of the arc that rounds off the corners.

heightback to summary
public float height

The height of this RoundRectangle2D.

widthback to summary
public float width

The width of this RoundRectangle2D.

xback to summary
public float x

The X coordinate of this RoundRectangle2D.

yback to summary
public float y

The Y coordinate of this RoundRectangle2D.

Constructor Detail

RoundRectangle2Dback to summary
public RoundRectangle2D()

Constructs a new RoundRectangle2D, initialized to location (0.0, 0.0), size (0.0, 0.0), and corner arcs of radius 0.0.

RoundRectangle2Dback to summary
public RoundRectangle2D(float x, float y, float w, float h, float arcw, float arch)

Constructs and initializes a RoundRectangle2D from the specified float coordinates.

Parameters
x:float

the X coordinate of the newly constructed RoundRectangle2D

y:float

the Y coordinate of the newly constructed RoundRectangle2D

w:float

the width to which to set the newly constructed RoundRectangle2D

h:float

the height to which to set the newly constructed RoundRectangle2D

arcw:float

the width of the arc to use to round off the corners of the newly constructed RoundRectangle2D

arch:float

the height of the arc to use to round off the corners of the newly constructed RoundRectangle2D

Method Detail

classifyback to summary
private int classify(float coord, float left, float right, float arcsize)
containsback to summary
public boolean contains(float x, float y)

Implements abstract com.sun.javafx.geom.Shape.contains.

Doc from com.sun.javafx.geom.Shape.contains.

Tests if the specified coordinates are inside the boundary of the Shape.

Parameters
x:float

the specified X coordinate to be tested

y:float

the specified Y coordinate to be tested

Returns:boolean

true if the specified coordinates are inside the Shape boundary; false otherwise.

Annotations
@Override
containsback to summary
public boolean contains(float x, float y, float w, float h)

Implements abstract com.sun.javafx.geom.Shape.contains.

Doc from com.sun.javafx.geom.Shape.contains.

Tests if the interior of the Shape entirely contains the specified rectangular area. All coordinates that lie inside the rectangular area must lie within the Shape for the entire rectanglar area to be considered contained within the Shape.

The Shape.contains() method allows a Shape implementation to conservatively return false when:

  • the intersect method returns true and
  • the calculations to determine whether or not the Shape entirely contains the rectangular area are prohibitively expensive.
This means that for some Shapes this method might return false even though the Shape contains the rectangular area. The Area class performs more accurate geometric computations than most Shape objects and therefore can be used if a more precise answer is required.
Parameters
x:float

the X coordinate of the upper-left corner of the specified rectangular area

y:float

the Y coordinate of the upper-left corner of the specified rectangular area

w:float

the width of the specified rectangular area

h:float

the height of the specified rectangular area

Returns:boolean

true if the interior of the Shape entirely contains the specified rectangular area; false otherwise or, if the Shape contains the rectangular area and the intersects method returns true and the containment calculations would be too expensive to perform.

Annotations
@Override
copyback to summary
public RoundRectangle2D copy()

Implements abstract com.sun.javafx.geom.Shape.copy.

Doc from com.sun.javafx.geom.Shape.copy.

Returns a new copy of this Shape instance.

Returns:RoundRectangle2D

a copy of this shape

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Determines whether or not the specified Object is equal to this RoundRectangle2D. The specified Object is equal to this RoundRectangle2D if it is an instance of RoundRectangle2D and if its location, size, and corner arc dimensions are the same as this RoundRectangle2D.

Parameters
obj:Object

an Object to be compared with this RoundRectangle2D.

Returns:boolean

true if obj is an instance of RoundRectangle2D and has the same values; false otherwise.

Annotations
@Override
getBoundsback to summary
public RectBounds getBounds()

Overrides com.sun.javafx.geom.RectangularShape.getBounds.

Doc from com.sun.javafx.geom.RectangularShape.getBounds.

Note that there is no guarantee that the returned RectBounds is the smallest bounding box that encloses the Shape, only that the Shape lies entirely within the indicated RectBounds.

Returns:RectBounds

Doc from com.sun.javafx.geom.Shape.getBounds.

an instance of RectBounds

Annotations
@Override
getHeightback to summary
public float getHeight()

Implements abstract com.sun.javafx.geom.RectangularShape.getHeight.

Doc from com.sun.javafx.geom.RectangularShape.getHeight.

Returns the height of the framing rectangle in double precision.

Returns:float

the height of the framing rectangle.

Annotations
@Override
getPathIteratorback to summary
public PathIterator getPathIterator(BaseTransform tx)

Implements abstract com.sun.javafx.geom.Shape.getPathIterator.

Returns an iteration object that defines the boundary of this RoundRectangle2D. The iterator for this class is multi-threaded safe, which means that this RoundRectangle2D class guarantees that modifications to the geometry of this RoundRectangle2D object do not affect any iterations of that geometry that are already in process.

Parameters
tx:BaseTransform

an optional BaseTransform to be applied to the coordinates as they are returned in the iteration, or null if untransformed coordinates are desired

Returns:PathIterator

the PathIterator object that returns the geometry of the outline of this RoundRectangle2D, one segment at a time.

Annotations
@Override
getWidthback to summary
public float getWidth()

Implements abstract com.sun.javafx.geom.RectangularShape.getWidth.

Doc from com.sun.javafx.geom.RectangularShape.getWidth.

Returns the width of the framing rectangle in double precision.

Returns:float

the width of the framing rectangle.

Annotations
@Override
getXback to summary
public float getX()

Implements abstract com.sun.javafx.geom.RectangularShape.getX.

Doc from com.sun.javafx.geom.RectangularShape.getX.

Returns the X coordinate of the upper-left corner of the framing rectangle in double precision.

Returns:float

the X coordinate of the upper-left corner of the framing rectangle.

Annotations
@Override
getYback to summary
public float getY()

Implements abstract com.sun.javafx.geom.RectangularShape.getY.

Doc from com.sun.javafx.geom.RectangularShape.getY.

Returns the Y coordinate of the upper-left corner of the framing rectangle in double precision.

Returns:float

the Y coordinate of the upper-left corner of the framing rectangle.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns the hashcode for this RoundRectangle2D.

Returns:int

the hashcode for this RoundRectangle2D.

Annotations
@Override
intersectsback to summary
public boolean intersects(float x, float y, float w, float h)

Implements abstract com.sun.javafx.geom.Shape.intersects.

Doc from com.sun.javafx.geom.Shape.intersects.

Tests if the interior of the Shape intersects the interior of a specified rectangular area. The rectangular area is considered to intersect the Shape if any point is contained in both the interior of the Shape and the specified rectangular area.

The Shape.intersects() method allows a Shape implementation to conservatively return true when:

  • there is a high probability that the rectangular area and the Shape intersect, but
  • the calculations to accurately determine this intersection are prohibitively expensive.
This means that for some Shapes this method might return true even though the rectangular area does not intersect the Shape. The Area class performs more accurate computations of geometric intersection than most Shape objects and therefore can be used if a more precise answer is required.
Parameters
x:float

the X coordinate of the upper-left corner of the specified rectangular area

y:float

the Y coordinate of the upper-left corner of the specified rectangular area

w:float

the width of the specified rectangular area

h:float

the height of the specified rectangular area

Returns:boolean

true if the interior of the Shape and the interior of the rectangular area intersect, or are both highly likely to intersect and intersection calculations would be too expensive to perform; false otherwise.

Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Implements abstract com.sun.javafx.geom.RectangularShape.isEmpty.

Doc from com.sun.javafx.geom.RectangularShape.isEmpty.

Determines whether the RectangularShape is empty. When the RectangularShape is empty, it encloses no area.

Returns:boolean

true if the RectangularShape is empty; false otherwise.

Annotations
@Override
setFrameback to summary
public void setFrame(float x, float y, float w, float h)

Implements abstract com.sun.javafx.geom.RectangularShape.setFrame.

Doc from com.sun.javafx.geom.RectangularShape.setFrame.

Sets the location and size of the framing rectangle of this Shape to the specified rectangular values.

Parameters
x:float

the X coordinate of the upper-left corner of the specified rectangular shape

y:float

the Y coordinate of the upper-left corner of the specified rectangular shape

w:float

the width of the specified rectangular shape

h:float

the height of the specified rectangular shape

Annotations
@Override
setRoundRectback to summary
public void setRoundRect(float x, float y, float w, float h, float arcw, float arch)

Sets the location, size, and corner radii of this RoundRectangle2D to the specified float values.

Parameters
x:float

the X coordinate to which to set the location of this RoundRectangle2D

y:float

the Y coordinate to which to set the location of this RoundRectangle2D

w:float

the width to which to set this RoundRectangle2D

h:float

the height to which to set this RoundRectangle2D

arcw:float

the width to which to set the arc of this RoundRectangle2D

arch:float

the height to which to set the arc of this RoundRectangle2D

setRoundRectback to summary
public void setRoundRect(RoundRectangle2D rr)

Sets this RoundRectangle2D to be the same as the specified RoundRectangle2D.

Parameters
rr:RoundRectangle2D

the specified RoundRectangle2D