Package ej.mwt.util

## Class Rectangle

- java.lang.Object
- - ej.mwt.util.Rectangle

- All Implemented Interfaces:
    `Outlineable`

      public class Rectangle
      extends Object
      implements Outlineable

  Represents a rectangle with a position and a size.

  For heap optimization the position and size are stored as a `short` and therefore are limited between `-32768` and `32767`.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Rectangle​(int x, int y, int width, int height)` | Creates a rectangle specifying its bounds.
    `Rectangle​(Rectangle rectangle)` | Creates a rectangle from the bounds of another rectangle.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addOutline​(int left, int top, int right, int bottom)` | Adds the given outline.
    `int` | `getHeight()` | Gets the height.
    `int` | `getWidth()` | Gets the width.
    `int` | `getX()` | Gets the x coordinate.
    `int` | `getY()` | Gets the y coordinate.
    `void` | `removeOutline​(int left, int top, int right, int bottom)` | Removes the given outline.
    `void` | `setBounds​(int x, int y, int width, int height)` | Sets the bounds of this rectangle.
    `void` | `setHeight​(int height)` | Sets the height.
    `void` | `setPosition​(int x, int y)` | Sets the position of this rectangle.
    `void` | `setSize​(int width, int height)` | Sets the size of this rectangle.
    `void` | `setWidth​(int width)` | Sets the width.
    `void` | `setX​(int x)` | Sets the x coordinate.
    `void` | `setY​(int y)` | Sets the y coordinate.

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

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Rectangle

          public Rectangle​(int x,
                           int y,
                           int width,
                           int height)

      Creates a rectangle specifying its bounds.
      Parameters:
        `x` - the x.
        `y` - the y.
        `width` - the width.
        `height` - the height.

    - #### Rectangle

          public Rectangle​(Rectangle rectangle)

      Creates a rectangle from the bounds of another rectangle.
      Parameters:
        `rectangle` - the other rectangle.

  - ### Method Detail

    - #### getX

          public int getX()

      Gets the x coordinate.
      Returns:
        the x.

    - #### setX

          public void setX​(int x)

      Sets the x coordinate.
      Parameters:
        `x` - the x.

    - #### getY

          public int getY()

      Gets the y coordinate.
      Returns:
        the y.

    - #### setY

          public void setY​(int y)

      Sets the y coordinate.
      Parameters:
        `y` - the y.

    - #### getWidth

          public int getWidth()

      Gets the width.
      Returns:
        the width.

    - #### setWidth

          public void setWidth​(int width)

      Sets the width.
      Parameters:
        `width` - the width.

    - #### getHeight

          public int getHeight()

      Gets the height.
      Returns:
        the height.

    - #### setHeight

          public void setHeight​(int height)

      Sets the height.
      Parameters:
        `height` - the height.

    - #### setPosition

          public void setPosition​(int x,
                                  int y)

      Sets the position of this rectangle.
      Parameters:
        `x` - the x.
        `y` - the y.

    - #### setSize

          public void setSize​(int width,
                              int height)

      Sets the size of this rectangle.
      Parameters:
        `width` - the width.
        `height` - the height.

    - #### setBounds

          public void setBounds​(int x,
                                int y,
                                int width,
                                int height)

      Sets the bounds of this rectangle.
      Parameters:
        `x` - the x.
        `y` - the y.
        `width` - the width.
        `height` - the height.

    - #### addOutline

          public void addOutline​(int left,
                                 int top,
                                 int right,
                                 int bottom)

      Description copied from interface: `Outlineable`
      Adds the given outline.
      Specified by:
        `addOutline` in interface `Outlineable`
      Parameters:
        `left` - the left side thickness of the outline.
        `top` - the top side thickness of the outline.
        `right` - the right side thickness of the outline.
        `bottom` - the bottom side thickness of the outline.

    - #### removeOutline

          public void removeOutline​(int left,
                                    int top,
                                    int right,
                                    int bottom)

      Description copied from interface: `Outlineable`
      Removes the given outline.
      Specified by:
        `removeOutline` in interface `Outlineable`
      Parameters:
        `left` - the left side thickness of the outline.
        `top` - the top side thickness of the outline.
        `right` - the right side thickness of the outline.
        `bottom` - the bottom side thickness of the outline.