Package org.eclipse.swt.graphics

# Class Rectangle.WithMonitor

java.lang.Object
org.eclipse.swt.graphics.Rectangle
org.eclipse.swt.graphics.Rectangle.OfFloat
org.eclipse.swt.graphics.Rectangle.WithMonitor

All Implemented Interfaces:
  `Serializable`, `Cloneable`

Enclosing class:
  `Rectangle`

public static final class Rectangle.WithMonitor extends Rectangle.OfFloat
Instances of this class represent `Rectangle.OfFloat` 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.131
See Also:
  - Serialized Form
Restriction:
  This class is not intended to be referenced by clients

## Nested Class Summary

## Nested classes/interfaces inherited from class org.eclipse.swt.graphics.Rectangle

`Rectangle.OfFloat, Rectangle.WithMonitor`

## Field Summary

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

`height, width, x, y`

## Constructor Summary

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

## Method Summary

Modifier and Type
Method
Description
`Rectangle.WithMonitor`
`clone()`
Creates and returns a copy of this `Rectangle`.
`Monitor`
`getMonitor()`
Returns the monitor with whose context the instance is created.

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

`from, getBottomRight, getHeight, getTopLeft, getWidth, getX, getY, setHeight, setWidth, setX, setY`

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

`add, contains, contains, equals, hashCode, intersect, intersection, intersects, intersects, isEmpty, of, of, toString, union`

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

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

## Constructor Details

### WithMonitor

public WithMonitor(int x, int y, int width, int height, Monitor monitor)
Constructs a new Rectangle.WithMonitor

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

### clone

public Rectangle.WithMonitor clone()
Description copied from class: `Rectangle`
Creates and returns a copy of this `Rectangle`.

This method performs a shallow copy of the rectangle's fields: `x`, `y`, `width`, and `height`. It does not copy any subclass-specific fields, so subclasses should override this method if additional fields exist.

Overrides:
  `clone` in class `Rectangle.OfFloat`
Returns:
  a new `Rectangle` instance with the same position and size as this one