Package net.sf.jaxodraw.gui.grid
Interface JaxoPaintableGrid
-
- All Superinterfaces:
JaxoGrid
,java.awt.Transparency
- All Known Implementing Classes:
JaxoDefaultGrid
public interface JaxoPaintableGrid extends JaxoGrid, java.awt.Transparency
A grid that can be painted.- Since:
- 2.1
-
-
Field Summary
Fields Modifier and Type Field Description static int
STYLE_CROSS
Cross style.static int
STYLE_DOT
Dot style.static int
STYLE_LINE
Line style.static int
STYLE_LINE_HONEYCOMB
Honeycomb style.static int
TYPE_HEXAGONAL
Hexagonal type.static int
TYPE_RECTANGULAR
Rectangular type.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addChangeListener(javax.swing.event.ChangeListener l)
ChangeEvents will be fired everytime the actual image of the grid changes (not on canvasSize changes).java.awt.Dimension
getCanvasSize()
Size of the grid canvas.java.awt.Color
getGridColor()
Color of the grid.int
getGridSize()
Returns the current size of the grid.int
getGridStyle()
Grid style (STYLE_XYZ constant).int
getGridType()
Returns the type of the grid.boolean
isPainted()
Determine if this grid gets painted.boolean
isSnapping()
Check if points are currently snapped to the grid.void
paint(java.awt.Graphics2D g)
Paints the grid.void
removeChangeListener(javax.swing.event.ChangeListener l)
Removes a change listener.void
setCanvasSize(java.awt.Dimension value)
Sets the size of the grid canvas.void
setGridColor(java.awt.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
-
-
-
-
Field Detail
-
TYPE_RECTANGULAR
static final int TYPE_RECTANGULAR
Rectangular type.- See Also:
- Constant Field Values
-
TYPE_HEXAGONAL
static final int TYPE_HEXAGONAL
Hexagonal type.- See Also:
- Constant Field Values
-
STYLE_DOT
static final int STYLE_DOT
Dot style.- See Also:
- Constant Field Values
-
STYLE_CROSS
static final int STYLE_CROSS
Cross style.- See Also:
- Constant Field Values
-
STYLE_LINE
static final int STYLE_LINE
Line style.- See Also:
- Constant Field Values
-
STYLE_LINE_HONEYCOMB
static final int STYLE_LINE_HONEYCOMB
Honeycomb style.- See Also:
- Constant Field Values
-
-
Method Detail
-
addChangeListener
void addChangeListener(javax.swing.event.ChangeListener l)
ChangeEvents will be fired everytime the actual image of the grid changes (not on canvasSize changes).- Parameters:
l
- The listener to add.
-
removeChangeListener
void removeChangeListener(javax.swing.event.ChangeListener l)
Removes a change listener.- Parameters:
l
- The listener to remove.
-
paint
void paint(java.awt.Graphics2D g)
Paints the grid.- Parameters:
g
- The graphics context to paint the grid.
-
getCanvasSize
java.awt.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
void setCanvasSize(java.awt.Dimension value)
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
java.awt.Color getGridColor()
Color of the grid.- Returns:
- The color of the grid.
-
setGridColor
void setGridColor(java.awt.Color value)
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.
-
-