com.internationalnetwork.gui
Class JListener

Object
  extended by com.internationalnetwork.gui.JListener
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.WindowListener, EventListener

public class JListener
extends Object
implements java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.WindowListener

The JListener class makes it really easy to capture mouse, keyboard, and window events for any number of components.  Instead of developing a class that implements the ActionListener, KeyListener, MouseListener, and WindowListener, the developer can simply add this class as the listener, and then wait in a blocked fashion for an event to occur.

Internally, this class uses a thread-safe atomic Queue to keep track of all events, so the developer can simply wait for an event to occur before handling the next event.


Field Summary
static String VERSION
          Version number of this Package (read-only).
 
Constructor Summary
JListener()
          Create a new JListener object.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Invoked when an action occurs.
 void keyPressed(java.awt.event.KeyEvent event)
          Invoked when an action occurs.
 void keyReleased(java.awt.event.KeyEvent event)
          Invoked when an action occurs.
 void keyTyped(java.awt.event.KeyEvent event)
          Invoked when an action occurs.
 void mouseClicked(java.awt.event.MouseEvent event)
          Invoked when an action occurs.
 void mouseEntered(java.awt.event.MouseEvent event)
          Invoked when an action occurs.
 void mouseExited(java.awt.event.MouseEvent event)
          Invoked when an action occurs.
 void mousePressed(java.awt.event.MouseEvent event)
          Invoked when an action occurs.
 void mouseReleased(java.awt.event.MouseEvent event)
          Invoked when an action occurs.
 JListenerEvent take()
          Gets the next event, waiting for an event if necessary.
 void windowActivated(java.awt.event.WindowEvent event)
          Invoked when an action occurs.
 void windowClosed(java.awt.event.WindowEvent event)
          Invoked when an action occurs.
 void windowClosing(java.awt.event.WindowEvent event)
          Invoked when an action occurs.
 void windowDeactivated(java.awt.event.WindowEvent event)
          Invoked when an action occurs.
 void windowDeiconified(java.awt.event.WindowEvent event)
          Invoked when an action occurs.
 void windowIconified(java.awt.event.WindowEvent event)
          Invoked when an action occurs.
 void windowOpened(java.awt.event.WindowEvent event)
          Invoked when an action occurs.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final String VERSION
Version number of this Package (read-only).

See Also:
Constant Field Values
Constructor Detail

JListener

public JListener()
Create a new JListener object.

Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Invoked when an action occurs.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
event - The event object

keyPressed

public void keyPressed(java.awt.event.KeyEvent event)
Invoked when an action occurs.

Specified by:
keyPressed in interface java.awt.event.KeyListener
Parameters:
event - The event object

keyReleased

public void keyReleased(java.awt.event.KeyEvent event)
Invoked when an action occurs.

Specified by:
keyReleased in interface java.awt.event.KeyListener
Parameters:
event - The event object

keyTyped

public void keyTyped(java.awt.event.KeyEvent event)
Invoked when an action occurs.

Specified by:
keyTyped in interface java.awt.event.KeyListener
Parameters:
event - The event object

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent event)
Invoked when an action occurs.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
event - The event object

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent event)
Invoked when an action occurs.

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
event - The event object

mouseExited

public void mouseExited(java.awt.event.MouseEvent event)
Invoked when an action occurs.

Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
event - The event object

mousePressed

public void mousePressed(java.awt.event.MouseEvent event)
Invoked when an action occurs.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
event - The event object

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent event)
Invoked when an action occurs.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
event - The event object

take

public JListenerEvent take()
Gets the next event, waiting for an event if necessary.

Returns:
JListenerEvent - Only one of four event objects is stored here; ActionEvent, KeyEvent, MouseEvent, or WindowEvent

windowActivated

public void windowActivated(java.awt.event.WindowEvent event)
Invoked when an action occurs.

Specified by:
windowActivated in interface java.awt.event.WindowListener
Parameters:
event - The event object

windowClosed

public void windowClosed(java.awt.event.WindowEvent event)
Invoked when an action occurs.

Specified by:
windowClosed in interface java.awt.event.WindowListener
Parameters:
event - The event object

windowClosing

public void windowClosing(java.awt.event.WindowEvent event)
Invoked when an action occurs.

Specified by:
windowClosing in interface java.awt.event.WindowListener
Parameters:
event - The event object

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent event)
Invoked when an action occurs.

Specified by:
windowDeactivated in interface java.awt.event.WindowListener
Parameters:
event - The event object

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent event)
Invoked when an action occurs.

Specified by:
windowDeiconified in interface java.awt.event.WindowListener
Parameters:
event - The event object

windowIconified

public void windowIconified(java.awt.event.WindowEvent event)
Invoked when an action occurs.

Specified by:
windowIconified in interface java.awt.event.WindowListener
Parameters:
event - The event object

windowOpened

public void windowOpened(java.awt.event.WindowEvent event)
Invoked when an action occurs.

Specified by:
windowOpened in interface java.awt.event.WindowListener
Parameters:
event - The event object