Rectangle
Leave feedback
On this page
Inheritance: java.lang.Object
public final class Rectangle
The Rectangle class represents changed area on a document.
Example usage:
try (Comparer comparer = new Comparer(sourceFile)) {
comparer.add(targetFile);
comparer.compare(resultFile);
final ChangeInfo[] changes = comparer.getChanges();
for (ChangeInfo change : changes) {
final Rectangle box = change.getBox();
// Print the changed area on page
System.out.println("Changed area on a page: "
+ box.getX() + ", " + box.getY() + ", " + box.getWidth() + ", " + box.getHeight());
}
}
| Constructor | Description |
|---|---|
| Rectangle() | Initializes a new instance of the Rectangle class. |
| Rectangle(Rectangle other) | Creates a new Rectangle object that is a copy of the specified rectangle. |
| Rectangle(double x, double y, double width, double height) | Creates a new instance of the Rectangle class with the specified x, y, width, and height. |
| Method | Description |
|---|---|
| getHeight() | Gets the height of the rectangle. |
| setHeight(double value) | Sets the height of the rectangle. |
| getWidth() | Gets the width of the rectangle. |
| setWidth(double value) | Sets the width of the rectangle. |
| getX() | Gets the x-coordinate of the top-left corner of the rectangle. |
| setX(double value) | Sets the x-coordinate of the top-left corner of the rectangle. |
| getY() | Gets the y-coordinate of the top-left corner of the rectangle. |
| setY(double value) | Sets the y-coordinate of the top-left corner of the rectangle. |
| equals(Object o) | {@inheritDoc} |
| hashCode() | {@inheritDoc} |
| toString() | {@inheritDoc} |
public Rectangle()
Initializes a new instance of the Rectangle class.
public Rectangle(Rectangle other)
Creates a new Rectangle object that is a copy of the specified rectangle.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| other | Rectangle | The rectangle to be copied |
public Rectangle(double x, double y, double width, double height)
Creates a new instance of the Rectangle class with the specified x, y, width, and height.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| x | double | The x-coordinate of the top-left corner of the rectangle |
| y | double | The y-coordinate of the top-left corner of the rectangle |
| width | double | The width of the rectangle |
| height | double | The height of the rectangle |
public double getHeight()
Gets the height of the rectangle.
Returns: double - the height of the rectangle
public void setHeight(double value)
Sets the height of the rectangle.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | double | The height of the rectangle |
public double getWidth()
Gets the width of the rectangle.
Returns: double - the width of the rectangle
public void setWidth(double value)
Sets the width of the rectangle.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | double | The width of the rectangle |
public double getX()
Gets the x-coordinate of the top-left corner of the rectangle.
Returns: double - the x-coordinate of the top-left corner of the rectangle
public void setX(double value)
Sets the x-coordinate of the top-left corner of the rectangle.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | double | The x-coordinate of the top-left corner of the rectangle |
public double getY()
Gets the y-coordinate of the top-left corner of the rectangle.
Returns: double - the y-coordinate of the top-left corner of the rectangle
public void setY(double value)
Sets the y-coordinate of the top-left corner of the rectangle.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | double | The y-coordinate of the top-left corner of the rectangle |
public boolean equals(Object o)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| o | java.lang.Object |
Returns: boolean
public int hashCode()
Returns: int
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.