Class GArc

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class GArc
    extends GFillableE
    • Field Summary

    • Constructor Summary

      Constructors 
      Constructor Description
      GArc​(int x, int y, int r, int a, int o)
      Generates an arc of a circle
      GArc​(int x, int y, int w, int h, int a, int o)
      Generates an arc of an oval
      GArc​(GArc e)
      Copy constructor
    • Constructor Detail

      • GArc

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

        public GArc​(int x,
                    int y,
                    int r,
                    int a,
                    int o)
        Generates an arc of a circle
        Parameters:
        x - x coordinate of the center of the circle
        y - y coordinate of the center of the circle
        r - radius of the circle
        a - angle of the arc (in degrees)
        o - offset of the arc (in degrees)
      • GArc

        public GArc​(int x,
                    int y,
                    int w,
                    int h,
                    int a,
                    int o)
        Generates an arc of an oval
        Parameters:
        x - x coordinate of the lower left corner
        y - y coordinate of the lower left corner
        w - width of the rectangle
        h - height of the rectangle
        a - angle of the arc (in degrees)
        o - offset of the arc (in degrees)
    • 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
      • move

        public void move​(int x,
                         int y)
        Moves the center of this arc to the given coordinates
        Parameters:
        x - new x coordinate
        y - new y coordinate
      • 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