Package VASSAL.tools

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

  • Constructor Details

    • NamedKeyStroke

      public NamedKeyStroke​(int code, int modifiers)
    • NamedKeyStroke

      public NamedKeyStroke​(int code, int modifiers, String s)
    • NamedKeyStroke

      public NamedKeyStroke​(KeyStroke k, String s)
    • NamedKeyStroke

      public NamedKeyStroke​(KeyStroke k)
    • NamedKeyStroke

      public NamedKeyStroke​(String s)
    • NamedKeyStroke

      public NamedKeyStroke()
  • Method Details

    • isNamed

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

      public String getName()
    • isNull

      public boolean isNull()
    • getStroke

      public KeyStroke getStroke()
      Return the raw KeyStroke stored in this NamedKeyStroke
      Returns:
      KeyStroke
    • equals

      public boolean equals​(Object o)
      Overrides:
      equals in class Object
    • getKeyStroke

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

      public static NamedKeyStroke getNamedKeyStroke​(char c)
    • getNamedKeyStroke

      public static NamedKeyStroke getNamedKeyStroke​(char c, int mod)
    • getNamedKeyStroke

      public static NamedKeyStroke getNamedKeyStroke​(int c, int mod)
    • getKeyStrokeForEvent

      public static NamedKeyStroke getKeyStrokeForEvent​(KeyEvent e)