|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--uci.gef.Mode
|
+--uci.gef.ModeCreate
Abstract superclass for all Mode's that create new Figs. This class factors our shared code that would otherwise be duplicated in its subclasses. On a mouse down the new item is created in memory. On mouse drag the new item is resized via its createDrag() method. On mouse up the new item is officially added to the Layer being edited in the parent Editor, the item is selected, and the Editor is placed in the next Mode (usually ModeSelect). Subclasses override various of these event handlers to give specific behaviors, for example, ModeCreateEdge handles dragging differently.
ModeCreateEdge,
ModeCreateFigRect,
ModeCreateFigRRect,
ModeCreateFigLine,
ModeCreateFigCircle,
ModeCreateFigPoly,
ModeCreateFigInk,
ModeCreateFigText,
ModeCreateFigImage, Serialized Form| Field Summary | |
protected static int |
_defaultHeight
The default size of a Fig if the user simply clicks instead of dragging out a size. |
protected static int |
_defaultWidth
The default size of a Fig if the user simply clicks instead of dragging out a size. |
protected Fig |
_newItem
This holds the Fig to be added to the parent Editor. |
protected int |
anchorX
Original mouse down event coordinates |
protected int |
anchorY
Original mouse down event coordinates |
| Fields inherited from class uci.gef.Mode |
_args,
_editor |
| Constructor Summary | |
ModeCreate()
|
|
ModeCreate(Editor par)
|
|
| Method Summary | |
abstract Fig |
createNewItem(MouseEvent me,
int snapX,
int snapY)
Abstact method to construct a new Fig to be added to the Editor. |
protected void |
creationDrag(int x,
int y)
Update the new item to reflect the new mouse position. |
Cursor |
getInitialCursor()
By default all creation modes use CROSSHAIR_CURSOR. |
void |
mouseDragged(MouseEvent me)
On mouse drag, resize the new item as the user moves the mouse. |
void |
mousePressed(MouseEvent me)
On mouse down, make a new Fig in memory. |
void |
mouseReleased(MouseEvent me)
On mouse up, officially add the new item to the parent Editor and select it. |
void |
paint(Graphics g)
Paint this mode by painting the new item. |
| Methods inherited from class uci.gef.Mode |
canExit,
done,
getArg,
getArgs,
getEditor,
instructions,
keyPressed,
keyReleased,
keyTyped,
mouseClicked,
mouseEntered,
mouseExited,
mouseMoved,
print,
setArg,
setArgs,
setCursor,
setEditor,
start |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
protected static int _defaultWidth
protected static int _defaultHeight
protected int anchorX
protected int anchorY
protected Fig _newItem
| Constructor Detail |
public ModeCreate(Editor par)
public ModeCreate()
| Method Detail |
public Cursor getInitialCursor()
public void mousePressed(MouseEvent me)
public void mouseDragged(MouseEvent me)
Note: _newItem has not been added to any Layer yet. So you cannot use _newItem.damage(), instead use _editor.damaged(_newItem).
public void mouseReleased(MouseEvent me)
protected void creationDrag(int x,
int y)
creationDrag(int, int)public void paint(Graphics g)
public abstract Fig createNewItem(MouseEvent me,
int snapX,
int snapY)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||