Rectangle
Leave feedback
On this page
Inheritance: java.lang.Object
public class Rectangle
Represents rectangle.
| Constructor | Description |
|---|---|
| Rectangle() | |
| Rectangle(float x, float y, float width, float height) | Initializes a new instance of the Rectangle class. |
| Rectangle(Rectangle rectangle) | Initializes a new instance of Rectangle class. |
| Method | Description |
|---|---|
| opEquality(Rectangle left, Rectangle right) | Compares two Rectangle objects. |
| opInequality(Rectangle left, Rectangle right) | Compares two Rectangle objects. |
| equals(Rectangle obj1, Rectangle obj2) | |
| getX() | Gets or sets the x. |
| setX(float value) | Gets or sets the x. |
| getY() | Gets or sets the y. |
| setY(float value) | Gets or sets the y. |
| getWidth() | Gets or sets the width. |
| setWidth(float value) | Gets or sets the width. |
| getHeight() | Gets or sets the height. |
| setHeight(float value) | Gets or sets the height. |
| equals(Object obj) | Determines whether the specified rectangle is equal to the current rectangle. |
| hashCode() | Serves as the default hash function. |
| toString() |
public Rectangle()
public Rectangle(float x, float y, float width, float height)
Initializes a new instance of the Rectangle class.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| x | float | The x. |
| y | float | The y. |
| width | float | The width. |
| height | float | The height. |
public Rectangle(Rectangle rectangle)
Initializes a new instance of Rectangle class.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| rectangle | Rectangle | The rectangle. |
public static boolean opEquality(Rectangle left, Rectangle right)
Compares two Rectangle objects. The result specifies whether the values of the Rectangle.X, Rectangle.Y, Rectangle.Width and Rectangle.Height properties of the two Rectangle objects are equal.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| left | Rectangle | A Rectangle to compare. |
| right | Rectangle | A Rectangle to compare. |
Returns: boolean - true if the Rectangle.X, Rectangle.Y, Rectangle.Width and Rectangle.Height values of left and right are equal; otherwise, false.
public static boolean opInequality(Rectangle left, Rectangle right)
Compares two Rectangle objects. The result specifies whether the values of the Rectangle.X, Rectangle.Y, Rectangle.Width and Rectangle.Height properties of the two Rectangle objects are not equal.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| left | Rectangle | A Rectangle to compare. |
| right | Rectangle | A Rectangle to compare. |
Returns: boolean - true if the Rectangle.X, Rectangle.Y, Rectangle.Width and Rectangle.Height values of left and right are not equal; otherwise, false.
public static boolean equals(Rectangle obj1, Rectangle obj2)
Parameters:
Returns: boolean
public final float getX()
Gets or sets the x.
Value: The x.
Returns: float -
public final void setX(float value)
Gets or sets the x.
Value: The x.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | float |
public final float getY()
Gets or sets the y.
Value: The y.
Returns: float -
public final void setY(float value)
Gets or sets the y.
Value: The y.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | float |
public final float getWidth()
Gets or sets the width.
Value: The width.
Returns: float -
public final void setWidth(float value)
Gets or sets the width.
Value: The width.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | float |
public final float getHeight()
Gets or sets the height.
Value: The height.
Returns: float -
public final void setHeight(float value)
Gets or sets the height.
Value: The height.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | float |
public boolean equals(Object obj)
Determines whether the specified rectangle is equal to the current rectangle.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| obj | java.lang.Object | The rectangle to compare with the current rectangle. |
Returns: boolean - if the specified rectangle is equal to the current rectangle; otherwise, .
public int hashCode()
Serves as the default hash function.
Returns: int - A hash code for the current rectangle.
public String toString()
Returns: java.lang.String
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.