Class Rectangle2D
java.lang.Object
javafx.geometry.Rectangle2D
A 2D rectangle used to describe the bounds of an object. It is defined by a
 location (minX, minY) and dimension (width x height).
- Since:
- JavaFX 2.0
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final Rectangle2DAn emptyRectangle2Dinstance (with all coordinates equal to zero).
- 
Constructor SummaryConstructorsConstructorDescriptionRectangle2D(double minX, double minY, double width, double height) Creates a new instance ofRectangle2D.
- 
Method SummaryModifier and TypeMethodDescriptionbooleancontains(double x, double y) Tests if the specified(x, y)coordinates are inside the boundary ofRectangle2D.booleancontains(double x, double y, double w, double h) Tests if the interior of thisRectangle2Dentirely contains the specified rectangular area.booleanTests if the specified point is inside the boundary ofRectangle2D.booleanTests if the interior of thisRectangle2Dentirely contains the specified Rectangle2D,r.booleanIndicates whether some other object is "equal to" this one.doubleThe height of thisRectangle2D.doublegetMaxX()The x coordinate of the lower-right corner of thisRectangle2D.doublegetMaxY()The y coordinate of the lower-right corner of thisRectangle2D.doublegetMinX()The x coordinate of the upper-left corner of thisRectangle2D.doublegetMinY()The y coordinate of the upper-left corner of thisRectangle2D.doublegetWidth()The width of thisRectangle2D.inthashCode()Returns a hash code for thisRectangle2Dobject.booleanintersects(double x, double y, double w, double h) Tests if the interior of thisRectangle2Dintersects the interior of a specified rectangular area.booleanTests if the interior of thisRectangle2Dintersects the interior of a specified Rectangle2D,r.toString()Returns a string representation of thisRectangle2D.
- 
Field Details- 
EMPTYAn emptyRectangle2Dinstance (with all coordinates equal to zero).
 
- 
- 
Constructor Details- 
Rectangle2Dpublic Rectangle2D(double minX, double minY, double width, double height) Creates a new instance ofRectangle2D.- Parameters:
- minX- The x coordinate of the upper-left corner of the- Rectangle2D
- minY- The y coordinate of the upper-left corner of the- Rectangle2D
- width- The width of the- Rectangle2D
- height- The height of the- Rectangle2D
 
 
- 
- 
Method Details- 
getMinXpublic double getMinX()The x coordinate of the upper-left corner of thisRectangle2D.- Default value:
- 0.0
- Returns:
- the x coordinate of the upper-left corner
 
- 
getMinYpublic double getMinY()The y coordinate of the upper-left corner of thisRectangle2D.- Default value:
- 0.0
- Returns:
- the y coordinate of the upper-left corner
 
- 
getWidthpublic double getWidth()The width of thisRectangle2D.- Default value:
- 0.0
- Returns:
- the width
 
- 
getHeightpublic double getHeight()The height of thisRectangle2D.- Default value:
- 0.0
- Returns:
- the height
 
- 
getMaxXpublic double getMaxX()The x coordinate of the lower-right corner of thisRectangle2D.- Default value:
- minX + width
- Returns:
- the x coordinate of the lower-right corner
 
- 
getMaxYpublic double getMaxY()The y coordinate of the lower-right corner of thisRectangle2D.- Default value:
- minY + height
- Returns:
- the y coordinate of the lower-right corner
 
- 
containsTests if the specified point is inside the boundary ofRectangle2D.- Parameters:
- p- the specified point to be tested
- Returns:
- true if the specified point is inside the boundary of this
 Rectangle2D; false otherwise
 
- 
containspublic boolean contains(double x, double y) Tests if the specified(x, y)coordinates are inside the boundary ofRectangle2D.- Parameters:
- x- the specified x coordinate to be tested
- y- the specified y coordinate to be tested
- Returns:
- true if the specified (x, y)coordinates are inside the boundary of thisRectangle2D; false otherwise
 
- 
containsTests if the interior of thisRectangle2Dentirely contains the specified Rectangle2D,r.- Parameters:
- r- The specified Rectangle2D
- Returns:
- true if the specified Rectangle2D, r, is inside the boundary of thisRectangle2D; false otherwise
 
- 
containspublic boolean contains(double x, double y, double w, double h) Tests if the interior of thisRectangle2Dentirely contains the specified rectangular area.- Parameters:
- x- the x coordinate of the upper-left corner of the specified rectangular area
- y- the y coordinate of the upper-left corner of the specified rectangular area
- w- the width of the specified rectangular area
- h- the height of the specified rectangular area
- Returns:
- true if the interior of this Rectangle2Dentirely contains the specified rectangular area; false otherwise
 
- 
intersectsTests if the interior of thisRectangle2Dintersects the interior of a specified Rectangle2D,r.- Parameters:
- r- The specified Rectangle2D
- Returns:
- true if the interior of this Rectangle2Dand the interior of the specified Rectangle2D,r, intersect
 
- 
intersectspublic boolean intersects(double x, double y, double w, double h) Tests if the interior of thisRectangle2Dintersects the interior of a specified rectangular area.- Parameters:
- x- the x coordinate of the upper-left corner of the specified rectangular area
- y- the y coordinate of the upper-left corner of the specified rectangular area
- w- the width of the specified rectangular area
- h- the height of the specified rectangular area
- Returns:
- true if the interior of this Rectangle2Dand the interior of the rectangular area intersect
 
- 
equals
- 
hashCode
- 
toStringReturns a string representation of thisRectangle2D. This method is intended to be used only for informational purposes. The content and format of the returned string might vary between implementations. The returned string might be empty but cannot benull.
 
-