Package org.eclipse.swt.graphics

# Class MonitorAwareRectangle

java.lang.Object
org.eclipse.swt.graphics.Rectangle
org.eclipse.swt.graphics.MonitorAwareRectangle

All Implemented Interfaces:
  `Serializable`

public final class MonitorAwareRectangle extends Rectangle
Instances of this class represent `Rectangle` objects along with the context of the monitor in relation to which they are placed on the display. The monitor awareness makes it easy to scale and translate the rectangles between pixels and points.

Since:
  3.129
See Also:
  - Serialized Form
Restriction:
  This class is not intended to be referenced by clients

## Field Summary

### Fields inherited from class org.eclipse.swt.graphics.Rectangle

`height, width, x, y`

## Constructor Summary

Constructors
Constructor
Description
`MonitorAwareRectangle(int x, int y, int width, int height, Monitor monitor)`
Constructs a new MonitorAwareRectangle

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object object)`
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
`Monitor`
`getMonitor()`
Returns the monitor with whose context the instance is created.
`int`
`hashCode()`
Returns an integer hash code for the receiver.

### Methods inherited from class org.eclipse.swt.graphics.Rectangle

`add, contains, contains, intersect, intersection, intersects, intersects, isEmpty, toString, union`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Constructor Details

### MonitorAwareRectangle

public MonitorAwareRectangle(int x, int y, int width, int height, Monitor monitor)
Constructs a new MonitorAwareRectangle

Parameters:
  `x` - the x coordinate of the top left corner of the rectangle
  `y` - the y coordinate of the top left corner of the rectangle
  `width` - the width of the rectangle
  `height` - the height of the rectangle
  `monitor` - the monitor with whose context the rectangle is created

## Method Details

### getMonitor

public Monitor getMonitor()
Returns the monitor with whose context the instance is created.

Returns:
  the monitor with whose context the instance is created

### equals

public boolean equals(Object object)
Description copied from class: `Rectangle`
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.

Overrides:
  `equals` in class `Rectangle`
Parameters:
  `object` - the object to compare with this object
Returns:
  `true` if the object is the same as this object and `false` otherwise
See Also:
  - `Rectangle.hashCode()`

### hashCode

public int hashCode()
Description copied from class: `Rectangle`
Returns an integer hash code for the receiver. Any two objects that return `true` when passed to `equals` must return the same value for this method.

Overrides:
  `hashCode` in class `Rectangle`
Returns:
  the receiver's hash
See Also:
  - `Rectangle.equals(Object)`