edu.stanford.hci.r3.pen
Class PenSimulator
java.lang.Object
edu.stanford.hci.r3.pen.PenInput
edu.stanford.hci.r3.pen.PenSimulator
- All Implemented Interfaces:
- java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener
public class PenSimulator
- extends PenInput
- implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener
Opens a JFrame/JPanel that the user can draw on with his mouse or Tablet stylus. This will simulate a
digital pen. We can make the pen activate by holding the left mouse button down.
This also contains a simple r-theta based ink simplification algorithm. Basically, if the distance of the
current point is sufficiently far from the last two points, in terms of distance (r) or direction (theta),
then we trigger a new pen sample. This algorithm might be applied to actual pen input in the future, to
achieve ink simplification/beautification, etc.
This software is distributed under the BSD License.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PenSimulator
public PenSimulator()
addLivePenListener
public void addLivePenListener(PenListener penListener)
- Description copied from class:
PenInput
- Adds a low-level pen data listener to the live pen. You SHOULD call this after starting live mode....
However, we can cache the listener for you, if you really want. This is to eliminate annoying ordering
constraints.
Subclasses *should* override this, and call the super, to actually make use of PenListeners.
- Overrides:
addLivePenListener
in class PenInput
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
- Specified by:
mouseClicked
in interface java.awt.event.MouseListener
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
- Specified by:
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent arg0)
- Specified by:
mouseEntered
in interface java.awt.event.MouseListener
mouseExited
public void mouseExited(java.awt.event.MouseEvent arg0)
- Specified by:
mouseExited
in interface java.awt.event.MouseListener
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent arg0)
- Specified by:
mouseMoved
in interface java.awt.event.MouseMotionListener
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
mousePressed
in interface java.awt.event.MouseListener
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Specified by:
mouseReleased
in interface java.awt.event.MouseListener
removeLivePenListener
public void removeLivePenListener(PenListener penListener)
- Description copied from class:
PenInput
- Removes the pen listener from the live pen. Subclasses *should* override this, and call the super's
implementation if necessary, to actually make use of PenListeners.
- Overrides:
removeLivePenListener
in class PenInput
startLiveMode
public void startLiveMode()
- Specified by:
startLiveMode
in class PenInput
stopLiveMode
public void stopLiveMode()
- Specified by:
stopLiveMode
in class PenInput