Enum Class KeyCommandBind

java.lang.Object
java.lang.Enum<KeyCommandBind>
megamek.client.ui.util.KeyCommandBind
All Implemented Interfaces:
Serializable, Comparable<KeyCommandBind>, Constable

public enum KeyCommandBind extends Enum<KeyCommandBind>
This enum is a collection of commands that can be bound to a particular key.
  • Enum Constant Details

  • Field Details

    • cmd

      public String cmd
      The command associated with this binding.
    • key

      public int key
      Defines the keycode for the command, e.g. KeyEvent.VK_X.
    • keyDefault

      public int keyDefault
    • modifiers

      public int modifiers
      Modifiers to the key code, such as InputEvent.CTRL_DOWN_MASK.
    • modifiersDefault

      public int modifiersDefault
    • isExclusive

      public boolean isExclusive
      Defines if an action is exclusive, which means that only one CommandAction will be performed for each key press. The CommandAction that is performed will be the first one encountered. Exclusive binds can't share their key with other binds.
    • isRepeatable

      public boolean isRepeatable
      For a repeatable bind, when the key is pressed the action will be added to a timer and repeated until the key is released.
    • isMenuBar

      public boolean isMenuBar
      When true, this keybind is used by the CommonMenuBar. Binding it with the MegaMekController like the other keybinds is not necessary (and will not work, as the command will not be recognized in this way).
  • Method Details

    • values

      public static KeyCommandBind[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static KeyCommandBind valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getBindByKey

      public static List<KeyCommandBind> getBindByKey(int keycode, int modifiers)
      Returns a list of binds using the given keycode and modifier. Only lists those that are not used by the CommonMenuBar!
    • getBindByCmd

      public static KeyCommandBind getBindByCmd(String cmd)
      Returns the bind identified by the given cmd or null if there is no such bind.
    • keyStroke

      public static KeyStroke keyStroke(KeyCommandBind bind)
      Returns a KeyStroke for a given KeyCommandBind.
    • getDesc

      public static String getDesc(KeyCommandBind k)
      returns formatted mod + key for display