hermes.postoffice
Class KeyMessage

java.lang.Object
  extended by hermes.postoffice.KeyMessage
All Implemented Interfaces:
Message

public class KeyMessage
extends java.lang.Object
implements Message

Message representing a key stroke. The type of the key message is determined by the key it corresponds to.


Constructor Summary
KeyMessage(int keyCode, char keyChar, boolean isPressed)
          Creates a new KeyMessage.
 
Method Summary
 boolean equals(java.lang.Object o)
          Checks for equality of KeyMessage by comparing key codes.
 char getKeyChar()
          Gets character representing the key acted upon if key is unicode.
 int getKeyCode()
          Gets code listed in POConstants corresponding to key
 boolean isPressed()
          Tells if key is pressed or not.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyMessage

public KeyMessage(int keyCode,
                  char keyChar,
                  boolean isPressed)
Creates a new KeyMessage.

Parameters:
keyCode - int corresponding to key, use PostOffice constants to determine key
keyChar - char corresponding to key, PostOffice.CHAR_UNDEFINED if key is non-unicode
isPressed - true when key is pressed, false when key is released
Method Detail

getKeyCode

public int getKeyCode()
Gets code listed in POConstants corresponding to key

Returns:
integer corresponding to key

getKeyChar

public char getKeyChar()
Gets character representing the key acted upon if key is unicode.

Returns:
char representing the key acted upon if key is unicode

isPressed

public boolean isPressed()
Tells if key is pressed or not.

Returns:
true is key is pressed, false if key is released

equals

public boolean equals(java.lang.Object o)
Checks for equality of KeyMessage by comparing key codes.

Overrides:
equals in class java.lang.Object