Class GGrid

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class GGrid
    extends GraphicE
    This class creates a simple line grid
    • Field Summary

    • Constructor Summary

      Constructors 
      Constructor Description
      GGrid​(int w, int h, int hd, int vd)  
      GGrid​(int x, int y, int w, int h, int hd, int vd)  
      GGrid​(GGrid e)
      Copy constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      GraphicE clone()  
      void draw​(java.awt.Graphics2D g)
      Draws the component on the given graphics
      void setPaint​(java.awt.Paint paint)
      Sets the Paint for this component
      void setStroke​(java.awt.Stroke stroke)
      Sets a new Stroke for this component
      void traslate​(int x, int y)
      Traslates this element on X and Y
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GGrid

        public GGrid​(GGrid e)
        Copy constructor
        Parameters:
        e - GGrid to copy
        Throws:
        java.lang.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 Detail

      • 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​(java.awt.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​(java.awt.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​(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