Class GOval

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class GOval
    extends GFillableE
    • Field Summary

    • Constructor Summary

      Constructors 
      Constructor Description
      GOval​(int x, int y, int w, int h)
      Constructs an oval inscribed in a rectangle
      GOval​(GOval e)
      Copy constructor
      GOval​(GRectangle r)
      Constructs an oval inscribed in a given rectangle
    • Constructor Detail

      • GOval

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

        public GOval​(GRectangle r)
              throws java.lang.IllegalArgumentException
        Constructs an oval inscribed in a given rectangle
        Parameters:
        r - rectangle that will contain the oval
        Throws:
        java.lang.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 Detail

      • draw

        public void draw​(java.awt.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
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class GFillableE
      • getShape

        public java.awt.geom.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