|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opensourcephysics.display.Grid
public class Grid
Grid draws a rectangular grid on a data panel.
Field Summary | |
---|---|
protected java.awt.Color |
color
|
protected double |
dx
|
protected double |
dy
|
protected java.awt.geom.GeneralPath |
generalPath
|
protected int |
nx
|
protected int |
ny
|
protected boolean |
visible
|
protected double |
xmax
|
protected double |
xmin
|
protected double |
ymax
|
protected double |
ymin
|
Constructor Summary | |
---|---|
Grid(int n)
Constructs a square grid of the given size with a spacing of 1. |
|
Grid(int nx,
int ny)
Constructs an (nx,ny) grid an x spacing of 1 and a y spacing of 1. |
|
Grid(int _nx,
int _ny,
double xmin,
double xmax,
double ymin,
double ymax)
Constructs a grid with the given number of x and y points and the given range. |
Method Summary | |
---|---|
void |
draw(DrawingPanel panel,
java.awt.Graphics g)
Draws a representation of an object in a drawing panel. |
int[] |
getCellPoint(double x,
double y)
Gets the cell column and row index for the specified location |
java.awt.geom.Point2D.Double |
getClosestGridPoint(double x,
double y)
Gets the grid point closest to the specified location |
java.awt.Color |
getColor()
Gets the drawing color. |
double |
getDx()
Gets the x separation between x gid lines. |
double |
getDy()
Gets the y separation between x gid lines. |
double |
getXMax()
Gets the maximum value of x. |
double |
getXMin()
Gets the minimum value of x. |
double |
getYMax()
Gets the maximum value of y. |
double |
getYMin()
Gets the minimum value of y. |
boolean |
isVisible()
Checks if the grid is visible. |
void |
setColor(java.awt.Color _color)
Sets the drawing color. |
void |
setMinMax(double _xmin,
double _xmax,
double _ymin,
double _ymax)
Assigns a scale to the grid in world units. |
void |
setVisible(boolean isVisible)
Sets the visible flag. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int nx
protected int ny
protected double xmin
protected double xmax
protected double ymin
protected double ymax
protected double dx
protected double dy
protected java.awt.Color color
protected java.awt.geom.GeneralPath generalPath
protected boolean visible
Constructor Detail |
---|
public Grid(int n)
n
- number of cells on a sidepublic Grid(int nx, int ny)
nx
- the number of grid lines in the x directionny
- the number of grid lines in the y directionpublic Grid(int _nx, int _ny, double xmin, double xmax, double ymin, double ymax)
_nx
- the number of grid lines in the x direction_ny
- the number of grid lines in the y directionxmin
- xmax
- ymin
- ymax
- Method Detail |
---|
public void setVisible(boolean isVisible)
isVisible
- public boolean isVisible()
public void setColor(java.awt.Color _color)
_color
- public java.awt.Color getColor()
public double getDx()
public double getXMin()
public double getXMax()
public double getYMin()
public double getYMax()
public double getDy()
public void setMinMax(double _xmin, double _xmax, double _ymin, double _ymax)
_xmin
- _xmax
- _ymin
- _ymax
- public void draw(DrawingPanel panel, java.awt.Graphics g)
Drawable
draw
in interface Drawable
public int[] getCellPoint(double x, double y)
public java.awt.geom.Point2D.Double getClosestGridPoint(double x, double y)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |