ptolemy.domains.ptera.lib
Class ReceiveInput.InputListener

java.lang.Object
  extended by ptolemy.domains.ptera.kernel.Event.RefiringData
      extended by ptolemy.domains.ptera.lib.ReceiveInput.InputListener
All Implemented Interfaces:
java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.WindowListener, java.util.EventListener
Enclosing class:
ReceiveInput

private class ReceiveInput.InputListener
extends Event.RefiringData
implements java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.WindowListener

The input listener to listen to the key and mouse input.

Since:
Ptolemy II 8.0
Version:
$Id: ReceiveInput.java 57044 2010-01-27 22:41:05Z cxh $
Author:
Thomas Huining Feng
Accepted Rating:
Red (tfeng)
Proposed Rating:
Yellow (tfeng)

Field Summary
private  java.lang.Class<?> _acceptableComponentType
          The class of components that can accept input.
private  java.lang.Class<?> _componentType
          Class of the component that actually receives the user input, which is automatically updated after the input is received.
private  boolean _finished
          Whether input listening is finished.
private  javax.swing.JFrame _frame
          The frame to be used.
private  java.util.regex.Pattern _keyPattern
          The key pattern.
private  java.lang.String _keyPressText
          The text of the key input, which is automatically updated after the input is received.
private  java.awt.Point _mousePressLocation
          Screen location of the mouse press, which is automatically updated after the input is received.
private  boolean _receiveKeyPress
          Whether key presses are acceptable.
private  boolean _receiveMousePress
          Whether mouse presses are acceptable.
 
Constructor Summary
ReceiveInput.InputListener(double timeAdvance, javax.swing.JFrame frame, java.lang.Class<?> acceptableComponentType, boolean receiveKeyPress, java.util.regex.Pattern keyPattern, boolean receiveMousePress)
          Construct an input listener.
 
Method Summary
private  void _finish()
          End the input listening.
 void keyPressed(java.awt.event.KeyEvent e)
          React to a key press event.
 void keyReleased(java.awt.event.KeyEvent e)
          Do nothing.
 void keyTyped(java.awt.event.KeyEvent e)
          Do nothing.
 void mouseClicked(java.awt.event.MouseEvent e)
          Do nothing.
 void mouseEntered(java.awt.event.MouseEvent e)
          Do nothing.
 void mouseExited(java.awt.event.MouseEvent e)
          Do nothing.
 void mousePressed(java.awt.event.MouseEvent e)
          React to a mouse press event.
 void mouseReleased(java.awt.event.MouseEvent e)
          Do nothing.
 void windowActivated(java.awt.event.WindowEvent e)
          Do nothing.
 void windowClosed(java.awt.event.WindowEvent e)
          Do nothing.
 void windowClosing(java.awt.event.WindowEvent e)
          End the input listening.
 void windowDeactivated(java.awt.event.WindowEvent e)
          Do nothing.
 void windowDeiconified(java.awt.event.WindowEvent e)
          Do nothing.
 void windowIconified(java.awt.event.WindowEvent e)
          Do nothing.
 void windowOpened(java.awt.event.WindowEvent e)
          Do nothing.
 
Methods inherited from class ptolemy.domains.ptera.kernel.Event.RefiringData
getTimeAdvance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_acceptableComponentType

private java.lang.Class<?> _acceptableComponentType
The class of components that can accept input.


_componentType

private java.lang.Class<?> _componentType
Class of the component that actually receives the user input, which is automatically updated after the input is received.


_finished

private boolean _finished
Whether input listening is finished.


_frame

private javax.swing.JFrame _frame
The frame to be used.


_keyPattern

private java.util.regex.Pattern _keyPattern
The key pattern.


_keyPressText

private java.lang.String _keyPressText
The text of the key input, which is automatically updated after the input is received.


_mousePressLocation

private java.awt.Point _mousePressLocation
Screen location of the mouse press, which is automatically updated after the input is received.


_receiveKeyPress

private boolean _receiveKeyPress
Whether key presses are acceptable.


_receiveMousePress

private boolean _receiveMousePress
Whether mouse presses are acceptable.

Constructor Detail

ReceiveInput.InputListener

ReceiveInput.InputListener(double timeAdvance,
                           javax.swing.JFrame frame,
                           java.lang.Class<?> acceptableComponentType,
                           boolean receiveKeyPress,
                           java.util.regex.Pattern keyPattern,
                           boolean receiveMousePress)
Construct an input listener.

Parameters:
timeAdvance - The amount of time advancement.
frame - The frame to be used.
acceptableComponentType - The class of components that can accept input.
receiveKeyPress - Whether key presses are acceptable.
keyPattern - The key pattern.
receiveMousePress - Whether mouse presses are acceptable.
Method Detail

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
React to a key press event.

Specified by:
keyPressed in interface java.awt.event.KeyListener
Parameters:
e - The key press event.

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Do nothing.

Specified by:
keyReleased in interface java.awt.event.KeyListener
Parameters:
e - The key release event.

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Do nothing.

Specified by:
keyTyped in interface java.awt.event.KeyListener
Parameters:
e - The key type event.

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Do nothing.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
e - The mouse click event.

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Do nothing.

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
e - The mouse enter event.

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Do nothing.

Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
e - The mouse exit event.

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
React to a mouse press event.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
e - The mouse press event.

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Do nothing.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
e - The mouse release event.

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Do nothing.

Specified by:
windowActivated in interface java.awt.event.WindowListener
Parameters:
e - The window activation event.

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Do nothing.

Specified by:
windowClosed in interface java.awt.event.WindowListener
Parameters:
e - The window close event.

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
End the input listening.

Specified by:
windowClosing in interface java.awt.event.WindowListener
Parameters:
e - The window closing event.

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Do nothing.

Specified by:
windowDeactivated in interface java.awt.event.WindowListener
Parameters:
e - The window deactivation event.

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Do nothing.

Specified by:
windowDeiconified in interface java.awt.event.WindowListener
Parameters:
e - The window deiconification event.

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Do nothing.

Specified by:
windowIconified in interface java.awt.event.WindowListener
Parameters:
e - The window iconification event.

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Do nothing.

Specified by:
windowOpened in interface java.awt.event.WindowListener
Parameters:
e - The window open event.

_finish

private void _finish()
End the input listening.