Class RectangleItem

All Implemented Interfaces:
IFeedbackProvider, IDrawable, EventListener
Direct Known Subclasses:
ImageItem, TextItem, VirtualWindowItem

public class RectangleItem extends PolygonItem
A closed, four-vertex PolygonItem initialized from a world-coordinate rectangle.

Unlike a general polygon, resizing (without shift/control) preserves the rectangle shape: reshape() moves only the dragged corner and its two adjacent vertices, keeping opposite sides axis-aligned with each other rather than allowing an arbitrary quadrilateral.

  • Constructor Details

    • RectangleItem

      public RectangleItem(Layer layer, Rectangle2D.Double wr, Object... keyVals)
      Create a world rectangle object.
      Parameters:
      layer - the z layer this item is on.
      wr - the initial bounds of the item.
      keyVals - optional key value pairs to set properties of the item. See AItem(Layer, Object...) for details.
    • RectangleItem

      public RectangleItem(Layer layer, Rectangle2D.Double wr)
      Create a world rectangle object.
      Parameters:
      layer - the z layer this item is on.
      wr - the initial bounds of the item.
  • Method Details

    • reshape

      protected void reshape()
      Reshape the item based on the modification. Keep in mind that if control or shift was pressed, the item will scale rather than coming here.
      Overrides:
      reshape in class PolygonItem