uci.gef
Class LayerGrid
java.lang.Object
|
+--uci.gef.Layer
|
+--uci.gef.LayerGrid
- public class LayerGrid
- extends Layer
Paint a background drawing guide consisting of horizontal and
vertical lines in a neutral color. This feature is common to many
drawing applications (e.g., MacDraw). LayerGrid is in concept a
Layer, just like any other so it can be composed, locked, grayed,
hidden, and reordered.
Needs-More-Work: Since I am using image stamping and AWT does not
support transparent pixels, any Layer underneath an instance of
LayerGrid will not be seen. Image stamping is nice because it is
fast, but I need to think of some other fast way to do it...
- See Also:
- Serialized Form
|
Field Summary |
protected Color |
_bgColor
The color of the space between the lines or dots. |
protected Color |
_color
The color of the grid lines or dots. |
protected int |
_dotSize
The size of the dots. |
protected boolean |
_paintBackground
True means to fill in the image stamp or drawing area with the
background color. |
|
Constructor Summary |
LayerGrid()
Construct a new LayerGrid and name it 'Grid'. |
LayerGrid(Color fore,
Color back,
int spacing,
boolean lines)
Construct a new LayerGrid with the given foreground color,
background color, line spacing, and lines/dots flag. |
|
Method Summary |
void |
adjust()
Eventually this will open a dialog box to let the user adjust
the grid line spacing, colors, and whether liens or dots are
shown. |
Vector |
getContents()
|
void |
paintContents(Graphics g)
Paint the grid lines or dots by repeatedly bitblting a
precomputed 'stamp' onto the given Graphics |
protected void |
paintDots(Graphics g,
boolean paintBackground)
Paint dots on the given Graphics. |
Fig |
presentationFor(Object obj)
|
| Methods inherited from class uci.gef.Layer |
add,
addEditor,
bringForward,
bringInFrontOf,
bringToFront,
damaged,
deleted,
elements,
elementsIn,
fetHidden,
findLayerNamed,
getContentsEdgesOnly,
getContentsNoEdges,
getEditors,
getGrayed,
getLocked,
getName,
getOnMenu,
getPerspectiveType,
hit,
nodesIn,
paint,
paintGrayContents,
postLoad,
postSave,
preSave,
print,
refreshEditors,
remove,
removeAll,
removeEditor,
reorder,
sendBackward,
sendToBack,
setGrayed,
setHidden,
setLocked,
setName,
setOnMenu,
setPerspectiveType,
toString |
_color
protected Color _color
- The color of the grid lines or dots.
_bgColor
protected Color _bgColor
- The color of the space between the lines or dots.
_paintBackground
protected boolean _paintBackground
- True means to fill in the image stamp or drawing area with the
background color. False means to just paint the lines or dots.
_dotSize
protected int _dotSize
- The size of the dots. Dots are actually small rectangles.
LayerGrid
public LayerGrid()
- Construct a new LayerGrid and name it 'Grid'.
LayerGrid
public LayerGrid(Color fore,
Color back,
int spacing,
boolean lines)
- Construct a new LayerGrid with the given foreground color,
background color, line spacing, and lines/dots flag.
getContents
public Vector getContents()
- Overrides:
- getContents in class Layer
presentationFor
public Fig presentationFor(Object obj)
- Overrides:
- presentationFor in class Layer
paintContents
public void paintContents(Graphics g)
- Paint the grid lines or dots by repeatedly bitblting a
precomputed 'stamp' onto the given Graphics
- Overrides:
- paintContents in class Layer
paintDots
protected void paintDots(Graphics g,
boolean paintBackground)
- Paint dots on the given Graphics.
adjust
public void adjust()
- Eventually this will open a dialog box to let the user adjust
the grid line spacing, colors, and whether liens or dots are
shown. For now it just cycles among 5 predefined styles.
- Overrides:
- adjust in class Layer