Rectangle2D (Java SE 10 & JDK 10 ) (original) (raw)
- javafx.geometry.Rectangle2D
public class Rectangle2D
extends Object
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 Summary
Fields
Modifier and Type Field Description static Rectangle2D EMPTY An empty Rectangle2D instance (with all coordinates equal to zero). Constructor Summary
Constructors
Constructor Description Rectangle2D(double minX, double minY, double width, double height) Creates a new instance of Rectangle2D. Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type Method Description boolean contains(double x, double y) Tests if the specified (x, y) coordinates are inside the boundary of Rectangle2D. boolean contains(double x, double y, double w, double h) Tests if the interior of this Rectangle2D entirely contains the specified rectangular area. boolean contains(Point2D p) Tests if the specified point is inside the boundary of Rectangle2D. boolean contains(Rectangle2D r) Tests if the interior of this Rectangle2D entirely contains the specified Rectangle2D, r. boolean equals(Object obj) Indicates whether some other object is "equal to" this one. double getHeight() The height of this Rectangle2D. double getMaxX() The x coordinate of the lower-right corner of this Rectangle2D. double getMaxY() The y coordinate of the lower-right corner of this Rectangle2D. double getMinX() The x coordinate of the upper-left corner of this Rectangle2D. double getMinY() The y coordinate of the upper-left corner of this Rectangle2D. double getWidth() The width of this Rectangle2D. int hashCode() Returns a hash code for this Rectangle2D object. boolean intersects(double x, double y, double w, double h) Tests if the interior of this Rectangle2D intersects the interior of a specified rectangular area. boolean intersects(Rectangle2D r) Tests if the interior of this Rectangle2D intersects the interior of a specified Rectangle2D, r. String toString() Returns a string representation of this Rectangle2D. * ### Methods declared in class java.lang.[Object](../../java/lang/Object.html "class in java.lang") `[clone](../../java/lang/Object.html#clone%28%29), [finalize](../../java/lang/Object.html#finalize%28%29), [getClass](../../java/lang/Object.html#getClass%28%29), [notify](../../java/lang/Object.html#notify%28%29), [notifyAll](../../java/lang/Object.html#notifyAll%28%29), [wait](../../java/lang/Object.html#wait%28%29), [wait](../../java/lang/Object.html#wait%28long%29), [wait](../../java/lang/Object.html#wait%28long,int%29)`
Field Detail
* #### EMPTY public static final [Rectangle2D](../../javafx/geometry/Rectangle2D.html "class in javafx.geometry") EMPTY An empty `Rectangle2D` instance (with all coordinates equal to zero).
Constructor Detail
* #### Rectangle2D public Rectangle2D(double minX, double minY, double width, double height) Creates a new instance of `Rectangle2D`. 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 Detail
* #### getMinX public double getMinX() The x coordinate of the upper-left corner of this `Rectangle2D`. Default value: 0.0 Returns: the x coordinate of the upper-left corner * #### getMinY public double getMinY() The y coordinate of the upper-left corner of this `Rectangle2D`. Default value: 0.0 Returns: the y coordinate of the upper-left corner * #### getWidth public double getWidth() The width of this `Rectangle2D`. Default value: 0.0 Returns: the width * #### getHeight public double getHeight() The height of this `Rectangle2D`. Default value: 0.0 Returns: the height * #### getMaxX public double getMaxX() The x coordinate of the lower-right corner of this `Rectangle2D`. Default value: `minX + width` Returns: the x coordinate of the lower-right corner * #### getMaxY public double getMaxY() The y coordinate of the lower-right corner of this `Rectangle2D`. Default value: `minY + height` Returns: the y coordinate of the lower-right corner * #### contains public boolean contains([Point2D](../../javafx/geometry/Point2D.html "class in javafx.geometry") p) Tests if the specified point is inside the boundary of `Rectangle2D`. Parameters: `p` \- the specified point to be tested Returns: 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 of `Rectangle2D`. 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 this `Rectangle2D`; false otherwise * #### contains public boolean contains([Rectangle2D](../../javafx/geometry/Rectangle2D.html "class in javafx.geometry") r) Tests if the interior of this `Rectangle2D` entirely contains the specified Rectangle2D, `r`. Parameters: `r` \- The specified Rectangle2D Returns: true if the specified Rectangle2D, `r`, is inside the boundary of this `Rectangle2D`; false otherwise * #### contains public boolean contains(double x, double y, double w, double h) Tests if the interior of this `Rectangle2D` entirely 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 `Rectangle2D` entirely contains the specified rectangular area; false otherwise * #### intersects public boolean intersects([Rectangle2D](../../javafx/geometry/Rectangle2D.html "class in javafx.geometry") r) Tests if the interior of this `Rectangle2D` intersects the interior of a specified Rectangle2D, `r`. Parameters: `r` \- The specified Rectangle2D Returns: true if the interior of this `Rectangle2D` and 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 this `Rectangle2D` intersects 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 `Rectangle2D` and the interior of the rectangular area intersect * #### equals public boolean equals([Object](../../java/lang/Object.html "class in java.lang") obj) Indicates whether some other object is "equal to" this one. Overrides: `[equals](../../java/lang/Object.html#equals%28java.lang.Object%29)` in class `[Object](../../java/lang/Object.html "class in java.lang")` Parameters: `obj` \- the reference object with which to compare. Returns: `true` if this object is equal to the `obj` argument; `false` otherwise See Also: [Object.hashCode()](../../java/lang/Object.html#hashCode%28%29), [HashMap](../../java/util/HashMap.html "class in java.util") * #### hashCode public int hashCode() Returns a hash code for this `Rectangle2D` object. Overrides: `[hashCode](../../java/lang/Object.html#hashCode%28%29)` in class `[Object](../../java/lang/Object.html "class in java.lang")` Returns: a hash code for this `Rectangle2D` object. See Also: [Object.equals(java.lang.Object)](../../java/lang/Object.html#equals%28java.lang.Object%29), [System.identityHashCode(java.lang.Object)](../../java/lang/System.html#identityHashCode%28java.lang.Object%29) * #### toString public [String](../../java/lang/String.html "class in java.lang") toString() Returns a string representation of this `Rectangle2D`. 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 be `null`. Overrides: `[toString](../../java/lang/Object.html#toString%28%29)` in class `[Object](../../java/lang/Object.html "class in java.lang")` Returns: a string representation of the object.
Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2018, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.