Package net.sf.jaxodraw.gui.grid
Interface JaxoPaintableGrid
- All Superinterfaces:
JaxoGrid
,Transparency
- All Known Implementing Classes:
JaxoDefaultGrid
A grid that can be painted.
- Since:
- 2.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Cross style.static final int
Dot style.static final int
Line style.static final int
Honeycomb style.static final int
Hexagonal type.static final int
Rectangular type.Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
-
Method Summary
Modifier and TypeMethodDescriptionvoid
ChangeEvents will be fired everytime the actual image of the grid changes (not on canvasSize changes).Size of the grid canvas.Color of the grid.int
Returns the current size of the grid.int
Grid style (STYLE_XYZ constant).int
Returns the type of the grid.boolean
Determine if this grid gets painted.boolean
Check if points are currently snapped to the grid.void
paint
(Graphics2D g) Paints the grid.void
Removes a change listener.void
setCanvasSize
(Dimension value) Sets the size of the grid canvas.void
setGridColor
(Color value) Sets the color of the grid points.void
setGridSize
(int value) Sets the size of the grid to the given value.void
setGridStyle
(int value) Set style, and repaint.void
setGridType
(int value) Sets the type of the grid (TYPE_XYZ).void
setPainted
(boolean painted) Determine if this grid gets painted.void
setSnapping
(boolean snapping) Switch on/off the snapping of this grid.Methods inherited from interface net.sf.jaxodraw.gui.grid.JaxoGrid
isSnapped, snappedPoint, snapPoint
Methods inherited from interface java.awt.Transparency
getTransparency
-
Field Details
-
TYPE_RECTANGULAR
static final int TYPE_RECTANGULARRectangular type.- See Also:
-
TYPE_HEXAGONAL
static final int TYPE_HEXAGONALHexagonal type.- See Also:
-
STYLE_DOT
static final int STYLE_DOTDot style.- See Also:
-
STYLE_CROSS
static final int STYLE_CROSSCross style.- See Also:
-
STYLE_LINE
static final int STYLE_LINELine style.- See Also:
-
STYLE_LINE_HONEYCOMB
static final int STYLE_LINE_HONEYCOMBHoneycomb style.- See Also:
-
-
Method Details
-
addChangeListener
ChangeEvents will be fired everytime the actual image of the grid changes (not on canvasSize changes).- Parameters:
l
- The listener to add.
-
removeChangeListener
Removes a change listener.- Parameters:
l
- The listener to remove.
-
paint
Paints the grid.- Parameters:
g
- The graphics context to paint the grid.
-
getCanvasSize
Dimension getCanvasSize()Size of the grid canvas. This is the size of the area on which the grid will be painted.- Returns:
- The size of the grid canvas.
-
setCanvasSize
Sets the size of the grid canvas. This is the size of the area on which the grid will be painted.- Parameters:
value
- The size to set.
-
setGridSize
void setGridSize(int value) Sets the size of the grid to the given value. This is the distance between two grid points. For a hexagonal grid, the grid size is always forced to be even.- Parameters:
value
- The grid size to be set.
-
getGridSize
int getGridSize()Returns the current size of the grid. This is the distance between two grid points.- Returns:
- The grid size.
-
setGridType
void setGridType(int value) Sets the type of the grid (TYPE_XYZ).- Parameters:
value
- The gridtype to be set.
-
getGridType
int getGridType()Returns the type of the grid.- Returns:
- The gridtype (TYPE_XYZ).
-
getGridStyle
int getGridStyle()Grid style (STYLE_XYZ constant). The default is STYLE_DOT.- Returns:
- The grid style.
-
setGridStyle
void setGridStyle(int value) Set style, and repaint.- Parameters:
value
- The style to set.
-
getGridColor
Color getGridColor()Color of the grid.- Returns:
- The color of the grid.
-
setGridColor
Sets the color of the grid points.- Parameters:
value
- The color to set.
-
isPainted
boolean isPainted()Determine if this grid gets painted. By default, a grid is painted.- Returns:
- true if the grid is switched on, false otherwise.
-
setPainted
void setPainted(boolean painted) Determine if this grid gets painted.- Parameters:
painted
- true if this grid should get painted, false otherwise.
-
isSnapping
boolean isSnapping()Check if points are currently snapped to the grid. By default snapping is off.- Returns:
- true if this grid snaps points, false otherwise.
-
setSnapping
void setSnapping(boolean snapping) Switch on/off the snapping of this grid.- Parameters:
snapping
- true if this grid should snap points, false otherwise.
-