|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjme.system.KeyBindingManager
KeyBindingManager
maintains a list of command and
key pairs. A key is denoted as an int and corresponds to Keyboard
's
constants.
NOTE: Current does not support multiple keys for a command
(i.e. ctrl+P = pause). This will be resolved soon.
Method Summary | |
void |
add(java.lang.String command,
int keyCode)
add adds a keycode to a command that already exists. |
void |
add(java.lang.String command,
int[] keyCode)
add adds a list of keycodes corresponding to a
command. |
int[] |
get(java.lang.String command,
int index)
get retrieves the key(s) for a given command. |
static KeyBindingManager |
getKeyBindingManager()
getInstance gets the static singleton instance of
the manager. |
boolean |
isValidCommand(java.lang.String command)
isValidCommand determines if a command is executable in
the current state of the keyboard. |
void |
remove(java.lang.String command)
remove deletes a key map from the list. |
void |
set(java.lang.String command,
int keyCode)
set sets the command to the given keycode overriding
any previous keycodes previously set for the same command. |
void |
set(java.lang.String command,
int[] keyCode)
set sets the command to the given list of keycodes
overriding any previous keycodes previously set for the same command. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public void set(java.lang.String command, int keyCode)
set
sets the command to the given keycode overriding
any previous keycodes previously set for the same command.
command
- the command to set.keyCode
- the key to set to the command.public void set(java.lang.String command, int[] keyCode)
set
sets the command to the given list of keycodes
overriding any previous keycodes previously set for the same command.
command
- the command to set.keyCode
- the list of keys to set to the command.public void add(java.lang.String command, int keyCode)
add
adds a keycode to a command that already exists. This
will not override the previous keycode, but add to it. Allowing the
two keys to perform the same command.
command
- the command to add to.keyCode
- the key to add to the command.public void add(java.lang.String command, int[] keyCode)
add
adds a list of keycodes corresponding to a
command. All the keys defined in the array must be pressed for
the command to be valid.
command
- the command to assign to the keys.keyCode
- the array of keys that must be pressed.public int[] get(java.lang.String command, int index)
get
retrieves the key(s) for a given command. An array
of ints are returned, where all ints would be required for the command
to be executed. For example: int[] = {KEY_1, KEY_2} would require
both 1 and 2 pressed at the same time.
command
- the requested key map
public boolean isValidCommand(java.lang.String command)
isValidCommand
determines if a command is executable in
the current state of the keyboard. That is, is a valid key pressed to
execute the requested command.
command
- the command to check.
public void remove(java.lang.String command)
remove
deletes a key map from the list.
command
- the key map to delete.public static KeyBindingManager getKeyBindingManager()
getInstance
gets the static singleton instance of
the manager.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |