Class Rectangle

All Implemented Interfaces:
GraphicalElement
Direct Known Subclasses:
Oval

public class Rectangle extends BasicGraphicalElement
A rectangle.
  • Constructor Details

    • Rectangle

      public Rectangle(GraphPoint center, double width, double height, GraphicAttributes attributes)
      Creates a new instance.
      Parameters:
      center - The position of the center of this element.
      width - The width.
      height - The height.
      attributes - Drawing attributes. Can be null.
  • Method Details

    • getCenter

      public GraphPoint getCenter()
      Returns the center of this element.
    • getWidth

      public double getWidth()
      Returns the width of this element.
    • getHeight

      public double getHeight()
      Returns the height of this element.
    • renderWith

      public void renderWith(Renderer renderer)
      Renders this rectangle with the specified Renderer.
      Parameters:
      renderer - An instance of RectangleRenderer.
      Throws:
      IllegalArgumentException - if renderer is not an instance of RectangleRenderer.