Class Rectangle2D
- javafx.geometry.Rectangle2D
public class Rectangle2D extends Object
Since:
JavaFX 2.0
-
Field Summary
Fields Modifier and Type Field and Description static Rectangle2DEMPTYAn emptyRectangle2Dinstance (with all coordinates equal to zero).
-
Constructor Summary
Constructors Constructor and Description Rectangle2D(double minX, double minY, double width, double height)Creates a new instance ofRectangle2D.
-
Method Summary
All MethodsInstance MethodsConcrete Methods Modifier and Type Method and Description booleancontains(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.booleancontains(Point2D p)Tests if the specified point is inside the boundary ofRectangle2D.booleancontains(Rectangle2D r)Tests if the interior of thisRectangle2Dentirely contains the specified Rectangle2D,r.booleanequals(Object obj)Indicates whether some other object is "equal to" this one.doublegetHeight()The 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.booleanintersects(Rectangle2D r)Tests if the interior of thisRectangle2Dintersects the interior of a specified Rectangle2D,r.StringtoString()Returns a string representation of thisRectangle2D.
-
Field Detail
-
EMPTY
public static final Rectangle2D EMPTY
An emptyRectangle2Dinstance (with all coordinates equal to zero).
-
-
Constructor Detail
-
Rectangle2D
public 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 theRectangle2D
-
-
Method Detail
-
getMinX
public double getMinX()
The x coordinate of the upper-left corner of thisRectangle2D.Default value:
0.0
-
getMinY
public double getMinY()
The y coordinate of the upper-left corner of thisRectangle2D.Default value:
0.0
-
getWidth
public double getWidth()
The width of thisRectangle2D.Default value:
0.0
-
getHeight
public double getHeight()
The height of thisRectangle2D.Default value:
0.0
-
getMaxX
public double getMaxX()
The x coordinate of the lower-right corner of thisRectangle2D.Default value:
minX + width
-
getMaxY
public double getMaxY()
The y coordinate of the lower-right corner of thisRectangle2D.Default value:
minY + height
-
contains
public boolean contains(Point2D p)
Tests if the specified point is inside the boundary ofRectangle2D.Parameters:
p- the specified point to be testedReturns:
true if the specified point is inside the boundary of this
Rectangle2D; false otherwise.
-
contains
public 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 testedReturns:
true if the specified
(x, y)coordinates are inside the boundary of thisRectangle2D; false otherwise.
-
contains
public boolean contains(Rectangle2D r)
Tests if the interior of thisRectangle2Dentirely contains the specified Rectangle2D,r.Parameters:
r- The specified Rectangle2DReturns:
true if the specified Rectangle2D,
r, is inside the boundary of thisRectangle2D; false otherwise.
-
contains
public 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 areaReturns:
true if the interior of this
Rectangle2Dentirely contains the specified rectangular area; false otherwise.
-
intersects
public boolean intersects(Rectangle2D r)
Tests if the interior of thisRectangle2Dintersects the interior of a specified Rectangle2D,r.Parameters:
r- The specified Rectangle2DReturns:
true if the interior of this
Rectangle2Dand the interior of the specified Rectangle2D,r, intersect.
-
intersects
public 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 areaReturns:
true if the interior of this
Rectangle2Dand the interior of the rectangular area intersect.
-
equals
public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one.
-
hashCode
public int hashCode()
Returns a hash code for thisRectangle2Dobject.
-
toString
public String toString()
Returns 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.
-
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.