
KeystrokeSensor |
ptolemy.actor.lib.gui.KeystrokeSensor |
Detect when the user types Control-C (for Copy) or Control-V (for Paste)
and produce an event on the corresponding output.
When this actor is preinitialized, it pops up a new JFrame window on
the desktop, usually in the upper left hand corner of the screen.
When this JFrame has the focus (such as when it has been clicked on)
it is capable of sensing keystrokes.
Only two keystrokes are sensed, control-C (for copy) and control-V
(for paste). This actor is designed to work with SystemClipboard.java.
The actor contains a private inner class which generates the JFrame.
This frame sets up call-backs which react to the keystrokes. When
called back, these in turn call the director's fireAtCurrentTime()
method. This causes the director to call fire() on the actor. The
actor then broadcasts tokens from one or both outputs depending on
which keystroke(s) have occurred since the actor was last fired.
NOTE: This actor only works in DE due to its reliance on the
director's fireAtCurrentTime() method.
Author(s): Winthrop Williams
Version:$Id: KeystrokeSensor.java,v 1.30 2005/10/28 20:15:58 cxh Exp $
Pt.Proposed Rating:Red (winthrop)
Pt.Accepted Rating:Red (winthrop)
controlV
Output port, which has type Token. If the user types Control-V,
then a token is broadcast on this port.
controlC
Output port, which has type Token. If the user types Control-C,
then a token is broadcast on this port.