|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgui.Grid
public class Grid
A grid object stores the current state of the grid.
Field Summary | |
---|---|
static double |
GRID_WIDTH
the default spacing of the grid |
private boolean |
snapToGrid
specifies if objects should snap to the grid |
private double |
spacing
the distance between different grid lines |
private boolean |
visible
specifies if the grid is visible |
Constructor Summary | |
---|---|
Grid(double spacing)
Constructs a grid with the specified spacing. |
Method Summary | |
---|---|
java.awt.geom.Point2D |
getGridCoordinate(double x,
double y)
Calculates the nearest grid point for the given coordinate. |
boolean |
getSnapToGrid()
Returns true if objects should snap to the grid. |
double |
getSpacing()
Gets the distance between grid lines. |
boolean |
isVisible()
Gets the visibility of the grid. |
void |
setSnapToGrid(boolean snap)
Sets if objects should snap to the grid. |
void |
setVisible(boolean visible)
Sets the visibility of the grid. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static double GRID_WIDTH
private boolean visible
private boolean snapToGrid
private double spacing
Constructor Detail |
---|
public Grid(double spacing)
spacing
- - the spacing between grid line.Method Detail |
---|
public void setSnapToGrid(boolean snap)
public boolean getSnapToGrid()
public void setVisible(boolean visible)
public boolean isVisible()
public double getSpacing()
public java.awt.geom.Point2D getGridCoordinate(double x, double y)
x
- - the x value of a coordinatey
- - the y value of a coordinate
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |