teamdev.jxdesktop
Class Keyboard

java.lang.Object
  extended byteamdev.jxdesktop.Keyboard

public abstract class Keyboard
extends java.lang.Object

Represents the system keyboard that allows listening all global keyboard events.

The Keyboard class provides functionality that allows listening keyboard events such as KeyEvent.KEY_PRESSED or KeyEvent.KEY_RELEASED for the current process and for other processes that are running in system.


Constructor Summary
protected Keyboard()
           
 
Method Summary
 void addKeyListener(java.awt.event.KeyListener listener)
          Adds the specified key listener to receive system key events.
static Keyboard createKeyboard()
          Creates a new instance of system keyboard.
 void dispose()
          Disposes of the system keyboard.
protected  void fireKeyPressed(java.awt.event.KeyEvent e)
           
protected  void fireKeyReleased(java.awt.event.KeyEvent e)
           
protected  void fireKeyTyped(java.awt.event.KeyEvent e)
           
 java.awt.event.KeyListener[] getKeyListeners()
          Returns an array of all the key listeners registered.
protected  void processEvent(java.awt.event.KeyEvent e)
           
 void removeKeyListener(java.awt.event.KeyListener listener)
          Removes the specified key listener so that it no longer receives system key events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Keyboard

protected Keyboard()
Method Detail

createKeyboard

public static Keyboard createKeyboard()
Creates a new instance of system keyboard. When you stop using Keyboard instance you must dispose it using the Keyboard.dispose() method.

Returns:
a new instance of keyboard.
Throws:
java.lang.RuntimeException - when the current operation system is not supported. Currently supported platforms are Windows XP, 2003, Vista and Mac OS X 10.5.+
See Also:
dispose()

addKeyListener

public void addKeyListener(java.awt.event.KeyListener listener)
Adds the specified key listener to receive system key events. If listener is null, no exception is thrown and no action is performed.

Parameters:
listener - the key listener

removeKeyListener

public void removeKeyListener(java.awt.event.KeyListener listener)
Removes the specified key listener so that it no longer receives system key events.

Parameters:
listener - the key listener

getKeyListeners

public java.awt.event.KeyListener[] getKeyListeners()
Returns an array of all the key listeners registered.

Returns:
all of system's KeyListeners or an empty array if no key listeners are currently registered

dispose

public void dispose()
Disposes of the system keyboard.


fireKeyPressed

protected void fireKeyPressed(java.awt.event.KeyEvent e)

fireKeyReleased

protected void fireKeyReleased(java.awt.event.KeyEvent e)

fireKeyTyped

protected void fireKeyTyped(java.awt.event.KeyEvent e)

processEvent

protected void processEvent(java.awt.event.KeyEvent e)