Package doodlepad

Class RoundRect

java.lang.Object
doodlepad.Shape
doodlepad.RoundRect

public class RoundRect extends Shape
A class that implements a graphical rectangle object with rounded corners
  • Constructor Details

    • RoundRect

      public RoundRect(double x, double y, double width, double height, double arcWidth, double arcHeight)
      Constructor for the RoundRect object, a rounded rectangle.
      Parameters:
      x - The x-coordinate of the upper left corner of the RoundRect object.
      y - The y-coordinate of the upper left corner of the RoundRect object.
      width - The width of the RoundRect object.
      height - The height of the RoundRect object.
      arcWidth - The width of the arc that forms a corner of the RoundRect object.
      arcHeight - The height of the arc that forms a corner of the RoundRect object.
    • RoundRect

      public RoundRect(double x, double y, double width, double height, double arcWidth, double arcHeight, Layer layer)
      Constructor for the RoundRect object, a rounded rectangle.
      Parameters:
      x - The x-coordinate of the upper left corner of the RoundRect object.
      y - The y-coordinate of the upper left corner of the RoundRect object.
      width - The width of the RoundRect object.
      height - The height of the RoundRect object.
      arcWidth - The width of the arc that forms a corner of the RoundRect object.
      arcHeight - The height of the arc that forms a corner of the RoundRect object.
      layer - The Layer object to which the Image should be added, or null if not to add to a Layer.
    • RoundRect

      public RoundRect()
      Default constructor for the RoundRect object. Creates a new 100x100 draggable shape and positions it randomly.
  • Method Details

    • toString

      public String toString()
      Generate a representation of the RoundRect object.
      Overrides:
      toString in class Shape
      Returns:
      String representation
    • draw

      public void draw(Graphics2D g)
      Draw the Rounded Rectangle
      Specified by:
      draw in class Shape
      Parameters:
      g - The Graphics2D object on which to draw the rounded rectangle.
    • getArea

      public Area getArea()
      Get the Area object associated with this round rectangle.
      Overrides:
      getArea in class Shape
      Returns:
      The Area object.