uci.gef
Class ModeCreateFigInk

java.lang.Object
  |
  +--uci.gef.Mode
        |
        +--uci.gef.ModeCreate
              |
              +--uci.gef.ModeCreateFigInk

public class ModeCreateFigInk
extends ModeCreate

A Mode to interpert user input while creating a FigInk. When creating a FigInk, new points are being added on mouseDragged, and a single mouseReleased ends the Mode. A new point is added whenever the mouse moves a minimum distance.

See Also:
Serialized Form

Field Summary
protected  int _lastX
          The position of the last point that was added.
protected  int _lastY
          The position of the last point that was added.
static int MIN_DELTA
          the minium distance that the mouse must move before a new point is added.
 
Fields inherited from class uci.gef.ModeCreate
_defaultHeight, _defaultWidth, _newItem, anchorX, anchorY
 
Fields inherited from class uci.gef.Mode
_args, _editor
 
Constructor Summary
ModeCreateFigInk()
           
 
Method Summary
 Fig createNewItem(MouseEvent me, int snapX, int snapY)
          Create a new FigInk instance based on the given mouse down event and the state of the parent Editor.
protected  void creationDrag(int x, int y)
           
 String instructions()
           
 void mouseDragged(MouseEvent me)
          Dragging adds points to the ink.
protected  boolean nearLast(int x, int y)
          Internal function to test if the current point is so close to the last point that it should not be added to the ink.
 
Methods inherited from class uci.gef.ModeCreate
getInitialCursor, mousePressed, mouseReleased, paint
 
Methods inherited from class uci.gef.Mode
canExit, done, getArg, getArgs, getEditor, 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

MIN_DELTA

public static final int MIN_DELTA
the minium distance that the mouse must move before a new point is added.

_lastX

protected int _lastX
The position of the last point that was added.

_lastY

protected int _lastY
The position of the last point that was added.
Constructor Detail

ModeCreateFigInk

public ModeCreateFigInk()
Method Detail

instructions

public String instructions()
Overrides:
instructions in class Mode

createNewItem

public Fig createNewItem(MouseEvent me,
                         int snapX,
                         int snapY)
Create a new FigInk instance based on the given mouse down event and the state of the parent Editor.
Overrides:
createNewItem in class ModeCreate

creationDrag

protected void creationDrag(int x,
                            int y)
Overrides:
creationDrag in class ModeCreate

mouseDragged

public void mouseDragged(MouseEvent me)
Dragging adds points to the ink.
Overrides:
mouseDragged in class ModeCreate

nearLast

protected boolean nearLast(int x,
                           int y)
Internal function to test if the current point is so close to the last point that it should not be added to the ink.