com.realtime.crossfire.jxclient.gui.keybindings
Class KeyCodeMap

java.lang.Object
  extended by com.realtime.crossfire.jxclient.gui.keybindings.KeyCodeMap

public class KeyCodeMap
extends java.lang.Object

Maps between key codes integer constants and string representations.


Field Summary
private  java.util.Map<java.lang.String,java.lang.Integer> keyCodes
          Maps key name to key code.
private  java.util.Map<java.lang.Integer,java.lang.String> keyNames
          Maps key code to key name.
 
Constructor Summary
KeyCodeMap()
          Creates a new instance.
 
Method Summary
 int getKeyCode(java.lang.String keyName)
          Returns the key code for a key name.
 java.lang.String getKeyName(int keyCode)
          Returns the key name for a key code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keyCodes

@NotNull
private final java.util.Map<java.lang.String,java.lang.Integer> keyCodes
Maps key name to key code.


keyNames

@NotNull
private final java.util.Map<java.lang.Integer,java.lang.String> keyNames
Maps key code to key name.

Constructor Detail

KeyCodeMap

public KeyCodeMap()
Creates a new instance.

Method Detail

getKeyCode

public int getKeyCode(@NotNull
                      java.lang.String keyName)
               throws NoSuchKeyCodeException
Returns the key code for a key name.

Parameters:
keyName - the key name to convert
Returns:
the key code
Throws:
NoSuchKeyCodeException - if the key name is invalid

getKeyName

@NotNull
public java.lang.String getKeyName(int keyCode)
Returns the key name for a key code.

Parameters:
keyCode - the key code to convert
Returns:
the key name