Package edu.cnu.mdi.view.demo.layout
Class GridDrawer
java.lang.Object
edu.cnu.mdi.graphics.drawable.DrawableAdapter
edu.cnu.mdi.view.demo.layout.GridDrawer
- All Implemented Interfaces:
IDrawable
-
Constructor Summary
ConstructorsConstructorDescriptionGridDrawer(int gridSize, Color gridColor) Create a grid drawer that draws a grid of the given size and color on the given container. -
Method Summary
Modifier and TypeMethodDescriptionvoiddraw(Graphics2D g, IContainer container) Render this drawable.intGet the grid size.Methods inherited from class edu.cnu.mdi.graphics.drawable.DrawableAdapter
getName, isEnabled, isVisible, prepareForRemoval, setDirty, setEnabled, setName, setVisible
-
Constructor Details
-
GridDrawer
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 pixelsgridColor- the color of the grid lines
-
-
Method Details
-
draw
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:
drawin interfaceIDrawable- Overrides:
drawin classDrawableAdapter- 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.
-