Package doodlepad

Class Oval


public class Oval extends Shape
A class that implements a graphical oval shape.
  • Constructor Details

    • Oval

      public Oval(double x, double y, double width, double height)
      Constructor for the Oval object.
      Parameters:
      x - The x-coordinate of the upper left-hand corner of the Oval object.
      y - The y-coordinate of the upper left-hand corner of the Oval object.
      width - The width of the Oval object.
      height - The height of the Oval object.
    • Oval

      public Oval(double x, double y, double width, double height, Pad pad)
      Constructor for the Oval object.
      Parameters:
      x - The x-coordinate of the upper left-hand corner of the Oval object.
      y - The y-coordinate of the upper left-hand corner of the Oval object.
      width - The width of the Oval object.
      height - The height of the Oval object.
      pad - The Pad to which the Oval should be added.
    • Oval

      public Oval(double x, double y, double width, double height, Layer layer)
      Constructor for the Oval object.
      Parameters:
      x - The x-coordinate of the upper left-hand corner of the Oval object.
      y - The y-coordinate of the upper left-hand corner of the Oval object.
      width - The width of the Oval object.
      height - The height of the Oval object.
      layer - The Layer object to which the Oval should be added, or null if not to add to a Layer.
    • Oval

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

    • toString

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

      public void draw(Graphics2D g)
      Draw the Oval shape
      Specified by:
      draw in class Shape
      Parameters:
      g - The Graphics2D object on which to draw the Oval
    • getArea

      public Area getArea()
      Complete the area of the Oval object
      Overrides:
      getArea in class Shape
      Returns:
      An Area object