|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.hws.jcm.draw.Drawable | +--edu.hws.jcm.draw.Grid
A Grid object draws a graph paper-like grid on a Canvas. The pixel width and height between adjacent grid lines is specified as a parameter to the constructer, or through the access methods "setXSP(double)" and "setYSP(double)". Note that the spacing will be scaled to between PIX_MIN and PIX_MAX (20 and 80, respectively, by default). The color of the grid lines can be set, and defaults to (220, 220, 220).
This class was written by Gabriel Weinstock (with some modifications by David Eck).
Fields inherited from class edu.hws.jcm.draw.Drawable |
canvas, coords |
Constructor Summary | |
Grid()
Create a Grid object with x and y spacing 1.0. |
|
Grid(double xspace,
double yspace)
Create a Grid object with spacing specified. |
Method Summary | |
void |
draw(java.awt.Graphics g,
boolean coordsch)
Draws the grid if an update is required. |
java.awt.Color |
getColor()
Access method which returns the Color of the grid lines. |
double |
getXSP()
Access method to return the x spacing used between grid lines. |
double |
getYSP()
Access method to return the y spacing used between grid lines |
void |
setColor(java.awt.Color c)
Method to set the Color used to draw grid lines. |
void |
setXSP(double x)
Method to set the x spacing between grid lines. |
void |
setYSP(double y)
Method to set the y spacing between grid lines. |
Methods inherited from class edu.hws.jcm.draw.Drawable |
getVisible, needsRedraw, setOwnerData, setVisible |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Grid()
public Grid(double xspace, double yspace)
Method Detail |
public java.awt.Color getColor()
public void setColor(java.awt.Color c)
public double getXSP()
public double getYSP()
public void setXSP(double x)
public void setYSP(double y)
public void draw(java.awt.Graphics g, boolean coordsch)
draw
in class Drawable
g
- the Graphics contextcoordsch
- boolean describing whether coordinates have changed
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |