Class NamedKeyStroke

java.lang.Object
VASSAL.tools.NamedKeyStroke

public class NamedKeyStroke extends Object
A NamedKeyStroke is a KeyStroke with a name given by the module developer. An actual KeyStroke is allocated from a pool of KeyStrokes at run-time and associated with the name. KeyStrokes have been replaced by NamedKeyStrokes within Vassal wherever the Stroke is saved. A standard KeyStroke is represented as a NamedKeyStroke with a null or zero-length name. NamedKeyStroke variables should never be null, use NULL_KEYSTROKE to represent a NamedKeyStroke with no value.
  • Field Details Link icon

    • NULL_KEYSTROKE Link icon

      public static final NamedKeyStroke NULL_KEYSTROKE
    • stroke Link icon

      protected final KeyStroke stroke
    • name Link icon

      protected final String name
  • Constructor Details Link icon

    • NamedKeyStroke Link icon

      public NamedKeyStroke(int code, int modifiers)
    • NamedKeyStroke Link icon

      public NamedKeyStroke(int code, int modifiers, String s)
    • NamedKeyStroke Link icon

      public NamedKeyStroke(KeyStroke k)
    • NamedKeyStroke Link icon

      public NamedKeyStroke(String s)
    • NamedKeyStroke Link icon

      public NamedKeyStroke()
    • NamedKeyStroke Link icon

      public NamedKeyStroke(KeyStroke k, String s)
  • Method Details Link icon

    • isNamed Link icon

      public boolean isNamed()
      Is there a name associated with this KeyStroke? No name means it is a standard KeyStroke.
      Returns:
      True if a name associated with this Keystroke
    • getName Link icon

      public String getName()
    • isNull Link icon

      public boolean isNull()
    • getStroke Link icon

      public KeyStroke getStroke()
      Return the raw KeyStroke stored in this NamedKeyStroke
      Returns:
      KeyStroke
    • getDesc Link icon

      public String getDesc()
      Returns:
      If a Named keystroke, returns the name string; otherwise if a "real" keystroke returns a string naming the keystroke (e.g. "Ctrl+C")
    • equals Link icon

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode Link icon

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getKeyStroke Link icon

      public KeyStroke getKeyStroke()
      Return the allocated KeyStroke associated with this KeyStroke
    • getNamedKeyStroke Link icon

      @Deprecated(since="2021-12-01", forRemoval=true) public static NamedKeyStroke getNamedKeyStroke(char c)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getNamedKeyStroke Link icon

      @Deprecated(since="2021-12-01", forRemoval=true) public static NamedKeyStroke getNamedKeyStroke(char c, int mod)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getNamedKeyStroke Link icon

      @Deprecated(since="2021-12-01", forRemoval=true) public static NamedKeyStroke getNamedKeyStroke(int c, int mod)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getKeyStrokeForEvent Link icon

      @Deprecated(since="2021-12-01", forRemoval=true) public static NamedKeyStroke getKeyStrokeForEvent(KeyEvent e)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • of Link icon

      public static NamedKeyStroke of(char c)
    • of Link icon

      public static NamedKeyStroke of(KeyEvent e)
    • of Link icon

      public static NamedKeyStroke of(char c, int modifiers)
    • of Link icon

      public static NamedKeyStroke of(int code, int modifiers)
    • of Link icon

      public static NamedKeyStroke of(int code, int modifiers, String s)
    • of Link icon

      public static NamedKeyStroke of(KeyStroke k)
    • of Link icon

      public static NamedKeyStroke of(String s)
    • of Link icon

      public static NamedKeyStroke of(KeyStroke k, String s)