Class NamedHotKeyConfigurer

java.lang.Object
VASSAL.configure.Configurer
VASSAL.configure.NamedHotKeyConfigurer
All Implemented Interfaces:
FocusListener, EventListener

public class NamedHotKeyConfigurer
extends Configurer
implements FocusListener
A configurer for Configuring Key Strokes. It allows the entry of either a standard keystroke, or a Named command. It contains two separate Text fields, one for the Name and one for the keystroke. A user can fill in one or the other. Filling in one, clears the other. This Configurer has a limited undo function. Whenever one of the two fields gains focus, the current state of the Configurer is saved and the Undo button enabled. The undo button will return to the state when that field gained focus. This provides a one-step undo if a user accidentally types in one of the fields and wipes out data in the other field.
  • Constructor Details

    • NamedHotKeyConfigurer

      public NamedHotKeyConfigurer​(String key, String name, NamedKeyStroke val)
    • NamedHotKeyConfigurer

      public NamedHotKeyConfigurer​(String key, String name)
    • NamedHotKeyConfigurer

      public NamedHotKeyConfigurer​(NamedKeyStroke val)
  • Method Details

    • getFancyString

      public static String getFancyString​(NamedKeyStroke k)
    • getString

      public static String getString​(NamedKeyStroke k)
      Return a String representation of a NamedKeyStroke
      Parameters:
      k - NamedKeyStroke
      Returns:
      String representation
    • getString

      public static String getString​(KeyStroke k)
      Return a string representation of a KeyStroke
      Parameters:
      k - KeyStroke
      Returns:
      String representation
    • getValueString

      public String getValueString()
      Specified by:
      getValueString in class Configurer
      Returns:
      a String representation of the Object value
    • getValueNamedKeyStroke

      public NamedKeyStroke getValueNamedKeyStroke()
    • isNamed

      public boolean isNamed()
    • setValue

      public void setValue​(Object o)
      Description copied from class: Configurer
      Set the Object value
      Overrides:
      setValue in class Configurer
    • updateVisibility

      protected void updateVisibility()
    • setValue

      public void setValue​(String s)
      Description copied from class: Configurer
      Set the Object value from a String
      Specified by:
      setValue in class Configurer
    • getControls

      public Component getControls()
      Description copied from class: Configurer
      GUI interface for setting the option in an editing window
      Specified by:
      getControls in class Configurer
    • focusGained

      public void focusGained​(FocusEvent e)
      Specified by:
      focusGained in interface FocusListener
    • focusLost

      public void focusLost​(FocusEvent e)
      Specified by:
      focusLost in interface FocusListener
    • keyToString

      public String keyToString()
    • isPrintableAscii

      protected boolean isPrintableAscii​(char c)
    • isPrintableAscii

      protected boolean isPrintableAscii​(int i)
    • decode

      public static NamedKeyStroke decode​(String s)
      Decode a String into a NamedKeyStroke
    • encode

      public static String encode​(NamedKeyStroke stroke)
      Encode a NamedKeyStroke into a String