Class KeyBinding
- java.lang.Object
-
- com.realtime.crossfire.jxclient.gui.keybindings.KeyBinding
-
- Direct Known Subclasses:
KeyCharKeyBinding,KeyCodeKeyBinding
public abstract class KeyBinding extends java.lang.ObjectAbstract base class for key bindings. A key binding consists of information about the bound key and an associatedCommandList.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedKeyBinding(@NotNull CommandList commands, boolean isDefault)Creates a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract booleanequals(@Nullable java.lang.Object obj)abstract @NotNull java.lang.StringgetBindingDescription()Return the binding as a human-readable text.@NotNull CommandListgetCommands()Returns the associatedCommandList.@NotNull java.lang.StringgetCommandString()Returns the commands as a string.abstract inthashCode()booleanisDefault()Returns whether the key binding is a "default" binding which should not be saved.abstract booleanmatchesKeyChar(char keyChar)Check whether this key binding matches a key character.abstract booleanmatchesKeyCode(@NotNull KeyEvent2 keyEvent)Checks whether this key binding matches a key code/modifiers pair.
-
-
-
Constructor Detail
-
KeyBinding
protected KeyBinding(@NotNull @NotNull CommandList commands, boolean isDefault)Creates a new instance.- Parameters:
commands- the commands to executeisDefault- whether the key binding is a "default" binding which should not be saved
-
-
Method Detail
-
getCommands
@NotNull public @NotNull CommandList getCommands()
Returns the associatedCommandList.- Returns:
- the associated command list
-
equals
public abstract boolean equals(@Nullable @Nullable java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public abstract int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
matchesKeyCode
public abstract boolean matchesKeyCode(@NotNull @NotNull KeyEvent2 keyEvent)Checks whether this key binding matches a key code/modifiers pair.- Parameters:
keyEvent- the key to check- Returns:
- whether the key binding matches the parameters
-
matchesKeyChar
public abstract boolean matchesKeyChar(char keyChar)
Check whether this key binding matches a key character.- Parameters:
keyChar- the key character to check- Returns:
- whether the key binding matches the parameters
-
getBindingDescription
@NotNull public abstract @NotNull java.lang.String getBindingDescription()
Return the binding as a human-readable text.- Returns:
- the human-readable text
-
getCommandString
@NotNull public @NotNull java.lang.String getCommandString()
Returns the commands as a string.- Returns:
- the commands as a string
-
isDefault
public boolean isDefault()
Returns whether the key binding is a "default" binding which should not be saved.- Returns:
true=do not save
-
-