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 intCross style.static final intDot style.static final intLine style.static final intHoneycomb style.static final intHexagonal type.static final intRectangular type.Fields inherited from interface Transparency
BITMASK, OPAQUE, TRANSLUCENT -
Method Summary
Modifier and TypeMethodDescriptionvoidChangeEvents will be fired everytime the actual image of the grid changes (not on canvasSize changes).Size of the grid canvas.Color of the grid.intReturns the current size of the grid.intGrid style (STYLE_XYZ constant).intReturns the type of the grid.booleanDetermine if this grid gets painted.booleanCheck if points are currently snapped to the grid.voidpaint(Graphics2D g) Paints the grid.voidRemoves a change listener.voidsetCanvasSize(Dimension value) Sets the size of the grid canvas.voidsetGridColor(Color value) Sets the color of the grid points.voidsetGridSize(int value) Sets the size of the grid to the given value.voidsetGridStyle(int value) Set style, and repaint.voidsetGridType(int value) Sets the type of the grid (TYPE_XYZ).voidsetPainted(boolean painted) Determine if this grid gets painted.voidsetSnapping(boolean snapping) Switch on/off the snapping of this grid.Methods inherited from interface JaxoGrid
isSnapped, snappedPoint, snapPointMethods inherited from interface 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
-
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
-
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.
-