Class GArc

All Implemented Interfaces:
Cloneable

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

    • GArc

      public GArc(GArc e)
      Copy constructor
      Parameters:
      e - GArc to copy
      Throws:
      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 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
    • 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
    • clone

      public GArc 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