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

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

public class KeyCodeKeyBinding
extends KeyBinding

A KeyBinding that matches by key code/modifiers pair.


Field Summary
private  int keyCode
          The key code to match.
private  int modifiers
          The modifiers to match.
 
Constructor Summary
KeyCodeKeyBinding(int keyCode, int modifiers, CommandList commands, boolean isDefault)
          Creates a KeyBinding that matches by key code/modifiers pair.
 
Method Summary
 boolean equals(java.lang.Object obj)
          
 int getKeyCode()
          Returns the key code to match.
 int getModifiers()
          Returns the modifiers to match.
 int hashCode()
          
 boolean matchesKeyChar(char keyChar)
          Check whether this key binding matches a key character.
 boolean matchesKeyCode(int keyCode, int modifiers)
          Checks whether this key binding matches a key code/modifiers pair.
 
Methods inherited from class com.realtime.crossfire.jxclient.gui.keybindings.KeyBinding
getCommands, getCommandString, isDefault
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keyCode

private final int keyCode
The key code to match.


modifiers

private final int modifiers
The modifiers to match.

Constructor Detail

KeyCodeKeyBinding

public KeyCodeKeyBinding(int keyCode,
                         int modifiers,
                         @NotNull
                         CommandList commands,
                         boolean isDefault)
Creates a KeyBinding that matches by key code/modifiers pair.

Parameters:
keyCode - the key code to match
modifiers - the modifiers to match
commands - the commands to associate with this binding
isDefault - whether the key binding is a "default" binding which should not be saved
Method Detail

equals

public boolean equals(@Nullable
                      java.lang.Object obj)

Specified by:
equals in class KeyBinding

getKeyCode

public int getKeyCode()
Returns the key code to match.

Returns:
the key code to match

getModifiers

public int getModifiers()
Returns the modifiers to match.

Returns:
the modifiers to match

hashCode

public int hashCode()

Specified by:
hashCode in class KeyBinding

matchesKeyChar

public boolean matchesKeyChar(char keyChar)
Check whether this key binding matches a key character.

Specified by:
matchesKeyChar in class KeyBinding
Parameters:
keyChar - the key character to check
Returns:
whether the key binding matches the parameters

matchesKeyCode

public boolean matchesKeyCode(int keyCode,
                              int modifiers)
Checks whether this key binding matches a key code/modifiers pair.

Specified by:
matchesKeyCode in class KeyBinding
Parameters:
keyCode - the key code to check
modifiers - the modifiers to check
Returns:
whether the key binding matches the parameters