Class GOval

All Implemented Interfaces:
Cloneable

public class GOval extends GFillableE
Author:
Federico Vera <[email protected]>
  • Constructor Details

    • GOval

      public GOval(GOval e)
      Copy constructor
      Parameters:
      e - GOval to copy
      Throws:
      IllegalArgumentException - if e is null
    • GOval

      public GOval(GRectangle r) throws IllegalArgumentException
      Constructs an oval inscribed in a given rectangle
      Parameters:
      r - rectangle that will contain the oval
      Throws:
      IllegalArgumentException - if the rectangle is null
    • GOval

      public GOval(int x, int y, int w, int h) throws InvalidArgumentException
      Constructs an oval inscribed in a rectangle
      Parameters:
      x - x coordinate of the center of the rectangle
      y - x coordinate of the center of the rectangle
      w - horizontal size of the rectangle
      h - vertical size of the rectangle
      Throws:
      InvalidArgumentException - if either h < 0 or w < 0
  • Method Details

    • draw

      public void draw(Graphics2D g)
      Description copied from class: GraphicE
      Draws the component on the given graphics
      Specified by:
      draw in class GraphicE
      Parameters:
      g - where to draw
    • traslate

      public void traslate(int x, int y)
      Description copied from class: GraphicE
      Traslates this element on X and Y
      Specified by:
      traslate in class GraphicE
      Parameters:
      x - size in px of the horizontal translation
      y - size in px of the vertical translation
    • clone

      public GOval clone()
      Specified by:
      clone in class GFillableE
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class GFillableE
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class GFillableE
    • getShape

      public Area getShape()
      Description copied from class: GFillableE
      This method should return a Area that represents the GFillableE. Since this is not always possible, and the implementation of Area isn't always easy, it should return null otherwise.
      In jDrawingLibs implementation we use the default shapes for this. Note that this method is only called to create clips for Graphic objects
      Specified by:
      getShape in class GFillableE
      Returns:
      Shape