Class GridDrawer

java.lang.Object
edu.cnu.mdi.graphics.drawable.DrawableAdapter
edu.cnu.mdi.view.demo.layout.GridDrawer
All Implemented Interfaces:
IDrawable

public class GridDrawer extends DrawableAdapter
  • Constructor Details

    • GridDrawer

      public GridDrawer(int gridSize, Color gridColor)
      Create a grid drawer that draws a grid of the given size and color on the given container.
      Parameters:
      gridSize - the size of the grid cells in pixels
      gridColor - the color of the grid lines
  • Method Details

    • draw

      public void draw(Graphics2D g, IContainer container)
      Render this drawable.

      The default implementation performs no drawing. Subclasses should override this method to render custom graphics.

      Draw a "snap to" grid overlay.

      Specified by:
      draw in interface IDrawable
      Overrides:
      draw in class DrawableAdapter
      Parameters:
      g - the 2D graphics context to draw with. The caller is responsible for restoring any graphics state (transform, clip, composite, etc.) if needed.
      container - the container being rendered into; may be used to query coordinate transforms, world bounds, etc.
    • getGridSize

      public int getGridSize()
      Get the grid size.