|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.jaxodraw.gui.grid.JaxoDefaultGrid
public class JaxoDefaultGrid
Paints a grid on the canvas.
| Field Summary |
|---|
| Fields inherited from interface net.sf.jaxodraw.gui.grid.JaxoPaintableGrid |
|---|
STYLE_CROSS, STYLE_DOT, STYLE_LINE, STYLE_LINE_HONEYCOMB, TYPE_HEXAGONAL, TYPE_RECTANGULAR |
| Fields inherited from interface java.awt.Transparency |
|---|
BITMASK, OPAQUE, TRANSLUCENT |
| Constructor Summary | |
|---|---|
JaxoDefaultGrid(int gsize,
int gtype)
Constructor. |
|
JaxoDefaultGrid(int gsize,
int gtype,
Dimension canvasDim)
Constructor: Sets the dimension, type and value from the arguments. |
|
JaxoDefaultGrid(int gsize,
int gtype,
int gridStyle,
Color color)
Constructor: Sets the dimension to the current screen size and take the other argument values. |
|
JaxoDefaultGrid(int gsize,
int gtype,
int gridStyle,
Color color,
Dimension canvasDim)
Constructor: Sets the dimension, type and value from the arguments. |
|
| Method Summary | |
|---|---|
void |
addChangeListener(ChangeListener l)
ChangeEvents will be fired everytime the actual image of the grid changes (not on canvasSize changes). |
Object |
clone()
Standard clone with all properties at the same values. |
void |
copyFrom(JaxoDefaultGrid g)
Copies all properties from the argument. |
protected void |
fireStateChanged()
Notifies all listeners of a state change. |
Color |
getBackground()
Background of the grid (filling the whole canvas). |
Dimension |
getCanvasSize()
Size of the grid canvas. |
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. |
int |
getTransparency()
Base on the 'transparent' property and the 'background' and 'gridColor' properties, assuming SRC_OVER rule. |
boolean |
isPainted()
Determine if this grid gets painted. |
boolean |
isSnapped(Point p)
Determines if 'p' is on the grid. |
boolean |
isSnapping()
Check if points are currently snapped to the grid. |
static JaxoDefaultGrid |
newDefaultGrid()
A new grid with the values from the preferences. |
void |
paint(Graphics2D g)
Paints the grid. |
void |
removeChangeListener(ChangeListener l)
Removes a change listener. |
void |
setBackground(Color value)
Sets the grid background color. |
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. |
Point |
snappedPoint(Point p)
Closest point to 'p' on the grid. |
void |
snapPoint(Point p)
Change 'p' to the closest point on the grid. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JaxoDefaultGrid(int gsize,
int gtype)
gsize - The grid size to be set.gtype - The grid type to be set.
public JaxoDefaultGrid(int gsize,
int gtype,
int gridStyle,
Color color)
gsize - The grid size to be set.gtype - The grid type to be set.gridStyle - The grid style to be setcolor - The grid color to be set
public JaxoDefaultGrid(int gsize,
int gtype,
Dimension canvasDim)
gsize - The grid size to be set.gtype - The grid type to be set.canvasDim - The canvasSize.
public JaxoDefaultGrid(int gsize,
int gtype,
int gridStyle,
Color color,
Dimension canvasDim)
gsize - The grid size to be set.gtype - The grid type to be set.gridStyle - The grid style to be set.color - The grid color to be set.canvasDim - The current canvas size.| Method Detail |
|---|
public Object clone()
throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedException - If the object's class does
not support the Cloneable interface.public void copyFrom(JaxoDefaultGrid g)
g - The grid to take the properties from.public void addChangeListener(ChangeListener l)
addChangeListener in interface JaxoPaintableGridl - The listener to add.public void removeChangeListener(ChangeListener l)
removeChangeListener in interface JaxoPaintableGridl - The listener to remove.protected void fireStateChanged()
public boolean isSnapped(Point p)
p.equals(snappedPoint(p)).
isSnapped in interface JaxoGridp - The point to snap.
public final Point snappedPoint(Point p)
snappedPoint in interface JaxoGridp - The point to snap.
public final void snapPoint(Point p)
snapPoint in interface JaxoGridp - The point to snap.public final int getTransparency()
getTransparency in interface Transparencypublic final void paint(Graphics2D g)
paint in interface JaxoPaintableGridg - The graphics context to paint the grid.public Dimension getCanvasSize()
getCanvasSize in interface JaxoPaintableGridpublic void setCanvasSize(Dimension value)
setCanvasSize in interface JaxoPaintableGridvalue - The size to set.public final void setGridSize(int value)
setGridSize in interface JaxoPaintableGridvalue - The grid size to be set.public final int getGridSize()
getGridSize in interface JaxoPaintableGridpublic final void setGridType(int value)
setGridType in interface JaxoPaintableGridvalue - The gridtype to be set.public final int getGridType()
getGridType in interface JaxoPaintableGridpublic final Color getGridColor()
getGridColor in interface JaxoPaintableGridpublic void setGridColor(Color value)
setGridColor in interface JaxoPaintableGridvalue - The color to set.public final Color getBackground()
public void setBackground(Color value)
value - The color to set.public final int getGridStyle()
getGridStyle in interface JaxoPaintableGridpublic void setGridStyle(int value)
setGridStyle in interface JaxoPaintableGridvalue - The style to set.public static final JaxoDefaultGrid newDefaultGrid()
public boolean isPainted()
isPainted in interface JaxoPaintableGridpublic void setPainted(boolean painted)
setPainted in interface JaxoPaintableGridpainted - true if this grid should get painted, false otherwise.public boolean isSnapping()
isSnapping in interface JaxoPaintableGridpublic void setSnapping(boolean snapping)
setSnapping in interface JaxoPaintableGridsnapping - true if this grid should snap points, false otherwise.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||