org.jagatoo.input.devices.components
Class Key

java.lang.Object
  extended by org.jagatoo.input.devices.components.DeviceComponent
      extended by org.jagatoo.input.devices.components.DigitalDeviceComponent
          extended by org.jagatoo.input.devices.components.Key

public class Key
extends DigitalDeviceComponent

A simple abstraction of a keyboard's key.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.jagatoo.input.devices.components.DeviceComponent
DeviceComponent.Type
 
Field Summary
 
Fields inherited from class org.jagatoo.input.devices.components.DeviceComponent
nextID
 
Constructor Summary
Key(java.lang.String keyName, boolean hasKeyChar)
           
 
Method Summary
 boolean equals(java.lang.Object key)
          
 int getKeyCode()
           
 KeyID getKeyID()
           
 int hashCode()
          
 boolean hasKeyChar()
           
 java.lang.String toString()
          
 
Methods inherited from class org.jagatoo.input.devices.components.DeviceComponent
bindAction, bindAction, getDeviceComponentID, getLocalizedName, getName, getType, isAnalog, isDigital, notifyBoundActions, unbindAction, unbindAction
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Key

public Key(java.lang.String keyName,
           boolean hasKeyChar)
Method Detail

getKeyID

public final KeyID getKeyID()
Returns:
this key's key-ID.

getKeyCode

public final int getKeyCode()
Returns:
this key's key-code. Each Key has a unique key-code, that starts at 1 for the first registered Key.
This is always equal to the KeyID's ordinal + 1.

hasKeyChar

public final boolean hasKeyChar()
Returns:
true, if this Key has a printable char.

equals

public boolean equals(java.lang.Object key)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object