com.jpemartin.jgt
Class KeyboardStatus

java.lang.Object
  extended by com.jpemartin.jgt.KeyboardStatus
All Implemented Interfaces:
java.awt.event.KeyListener, java.util.EventListener

public class KeyboardStatus
extends java.lang.Object
implements java.awt.event.KeyListener

Maintains a boolean array: for each key, true if the key is pressed. The idea is that you register a KeyboardStatus as KeyListener in your application and then you can look up the array to see which keys are down.

Author:
jpmartin

Field Summary
 boolean[] key
           
 
Constructor Summary
KeyboardStatus()
           
 
Method Summary
 void keyPressed(java.awt.event.KeyEvent arg0)
           
 void keyReleased(java.awt.event.KeyEvent arg0)
           
 void keyTyped(java.awt.event.KeyEvent arg0)
           
 void reset()
          consider all keys "up" regardless of their actual state
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

key

public boolean[] key
Constructor Detail

KeyboardStatus

public KeyboardStatus()
Method Detail

reset

public void reset()
consider all keys "up" regardless of their actual state


keyTyped

public void keyTyped(java.awt.event.KeyEvent arg0)
Specified by:
keyTyped in interface java.awt.event.KeyListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent arg0)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent arg0)
Specified by:
keyReleased in interface java.awt.event.KeyListener