 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.gui.keybindings;
26 import java.awt.event.InputEvent;
27 import java.awt.event.KeyEvent;
28 import org.jetbrains.annotations.NotNull;
29 import org.jetbrains.annotations.Nullable;
37 public class KeyBinding implements Comparable<KeyBinding> {
94 return this.keyEvent.matchesKeyEvent(
keyEvent);
98 public boolean equals(@Nullable
final Object obj) {
118 final StringBuilder sb =
new StringBuilder();
120 if (keyCode == KeyEvent.VK_UNDEFINED) {
125 sb.append(InputEvent.getModifiersExText(modifiers)).append(
"+");
127 sb.append(KeyEvent.getKeyText(keyCode));
129 return sb.toString();
String getCommandString()
Returns the commands as a string.
static final int NONE
The mask for "no modifier".
boolean isDefault()
Returns whether the key binding is a "default" binding which should not be saved.
boolean equals(@Nullable final Object obj)
final boolean isDefault
Whether the key binding is a "default" binding which should not be saved.
KeyEvent2 getKeyEvent2()
Returns the key to match.
CommandList getCommands()
Returns the associated CommandList.
Represents a pressed or released key.
final KeyEvent2 keyEvent
The key to match.
Abstract base class for key bindings.
KeyBinding(@NotNull final KeyEvent2 keyEvent, @NotNull final CommandList commands, final boolean isDefault)
Creates a new instance.
char getKeyChar()
Returns the key as a char.
int compareTo(@NotNull final KeyBinding o)
String getBindingDescription()
Return the binding as a human-readable text.
int getKeyCode()
Returns the key code.
final CommandList commands
The associated CommandList.
boolean equals(@Nullable final Object obj)
int getModifiers()
Returns the modifiers.
A list of GUICommand instances.
String getCommandString()
Returns the commands as a string.
boolean matchesKeyEvent(@NotNull final KeyEvent2 keyEvent)
Checks whether this key binding matches a key event.
int compareTo(@NotNull final KeyEvent2 o)