Class GGrid

All Implemented Interfaces:
Cloneable

public class GGrid extends GraphicE
This class creates a simple line grid
Author:
Federico Vera <[email protected]>
  • Constructor Details

    • GGrid

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

      public GGrid(int w, int h, int hd, int vd) throws InvalidArgumentException
      Parameters:
      w - width of the grid
      h - height of the grid
      hd - horizontal distance between lines, if 0 there will be no horizontal lines
      vd - vertical distance between lines, if 0 there will be no vertical lines.
      Throws:
      InvalidArgumentException - if w <= 0 or h <= 0
    • GGrid

      public GGrid(int x, int y, int w, int h, int hd, int vd) throws InvalidArgumentException
      Parameters:
      x - x coordinate of the center
      y - y coordinate of the center
      w - width of the grid
      h - height of the grid
      hd - horizontal distance between lines, if 0 there will be no horizontal lines
      vd - vertical distance between lines, if 0 there will be no vertical lines.
      Throws:
      InvalidArgumentException - if w <= 0 or h <= 0
  • Method Details

    • 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
    • setStroke

      public void setStroke(Stroke stroke)
      Description copied from class: GraphicE
      Sets a new Stroke for this component
      Overrides:
      setStroke in class GraphicE
      Parameters:
      stroke - the Stroke to use
    • setPaint

      public void setPaint(Paint paint)
      Description copied from class: GraphicE
      Sets the Paint for this component
      Overrides:
      setPaint in class GraphicE
      Parameters:
      paint - the paint use to render this GraphicE
    • 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
    • clone

      public GraphicE clone()
      Specified by:
      clone in class GraphicE