Class PenSimulator

  extended by edu.stanford.hci.r3.pen.PenInput
      extended by 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.

Field Summary
Fields inherited from class edu.stanford.hci.r3.pen.PenInput
liveMode, penListenersToAdd
Constructor Summary
Method Summary
 void addLivePenListener(PenListener penListener)
          Adds a low-level pen data listener to the live pen.
 void mouseClicked(java.awt.event.MouseEvent e)
 void mouseDragged(java.awt.event.MouseEvent e)
 void mouseEntered(java.awt.event.MouseEvent arg0)
 void mouseExited(java.awt.event.MouseEvent arg0)
 void mouseMoved(java.awt.event.MouseEvent arg0)
 void mousePressed(java.awt.event.MouseEvent e)
 void mouseReleased(java.awt.event.MouseEvent e)
 void removeLivePenListener(PenListener penListener)
          Removes the pen listener from the live pen.
 void startLiveMode()
 void stopLiveMode()
Methods inherited from class edu.stanford.hci.r3.pen.PenInput
getName, isLive, setName
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public PenSimulator()
Method Detail


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.

addLivePenListener in class PenInput


public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener


public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener


public void mouseEntered(java.awt.event.MouseEvent arg0)
Specified by:
mouseEntered in interface java.awt.event.MouseListener


public void mouseExited(java.awt.event.MouseEvent arg0)
Specified by:
mouseExited in interface java.awt.event.MouseListener


public void mouseMoved(java.awt.event.MouseEvent arg0)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener


public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener


public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener


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.

removeLivePenListener in class PenInput


public void startLiveMode()
Specified by:
startLiveMode in class PenInput


public void stopLiveMode()
Specified by:
stopLiveMode in class PenInput

Copyright 2006 Stanford University