java.lang.Object
com.realtime.crossfire.jxclient.gui.keybindings.KeyBinding
All Implemented Interfaces:
Comparable<KeyBinding>

public class KeyBinding extends Object implements Comparable<KeyBinding>
Abstract base class for key bindings. A key binding consists of information about the bound key and an associated CommandList.
  • Constructor Details

    • KeyBinding

      public KeyBinding(@NotNull @NotNull KeyEvent2 keyEvent, @NotNull @NotNull CommandList commands, boolean isDefault)
      Creates a new instance.
      Parameters:
      keyEvent - the key to match
      commands - the commands to execute
      isDefault - whether the key binding is a "default" binding which should not be saved
  • Method Details

    • getKeyEvent2

      @NotNull public @NotNull KeyEvent2 getKeyEvent2()
      Returns the key to match.
      Returns:
      the key to match
    • getCommands

      @NotNull public @NotNull CommandList getCommands()
      Returns the associated CommandList.
      Returns:
      the associated command list
    • matchesKeyEvent

      public boolean matchesKeyEvent(@NotNull @NotNull KeyEvent2 keyEvent)
      Checks whether this key binding matches a key event.
      Parameters:
      keyEvent - the key to check
      Returns:
      whether the key binding matches the parameters
    • equals

      public boolean equals(@Nullable @Nullable Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(@NotNull @NotNull KeyBinding o)
      Specified by:
      compareTo in interface Comparable<KeyBinding>
    • getBindingDescription

      @NotNull public @NotNull String getBindingDescription()
      Return the binding as a human-readable text.
      Returns:
      the human-readable text
    • getCommandString

      @NotNull public @NotNull 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