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, int defaultFieldLength)
    • NamedHotKeyConfigurer

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

      public NamedHotKeyConfigurer(String key, String name)
    • NamedHotKeyConfigurer

      public NamedHotKeyConfigurer(NamedKeyStroke val, int defaultFieldLength)
    • NamedHotKeyConfigurer

      public NamedHotKeyConfigurer(NamedKeyStroke val)
    • NamedHotKeyConfigurer

      public NamedHotKeyConfigurer()
  • 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()
    • requestFocus

      public void requestFocus()
      Description copied from class: Configurer
      Move the cursor to the first input field of this Configurer
      Overrides:
      requestFocus in class Configurer
    • 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
    • setHighlighted

      public void setHighlighted(boolean highlighted)
      Description copied from class: Configurer
      Set the highlighted status of this configurer. It is up to individual Configurers to override this method and implement a suitable visual highlighting scheme Note: Cannot make this abstract as it will break custom code.
      Overrides:
      setHighlighted in class Configurer
      Parameters:
      highlighted - New Highlighted status
    • addFocusListener

      public void addFocusListener(FocusListener listener)
      Description copied from class: Configurer
      Add a FocusListener to the Swing Components that make up this Configurer.
      Overrides:
      addFocusListener in class Configurer
      Parameters:
      listener - Focus Listener
    • removeFocusListener

      public void removeFocusListener(FocusListener listener)
      Description copied from class: Configurer
      Remove a FocusListener from the Swing Components that make up this Configurer.
      Overrides:
      removeFocusListener in class Configurer
      Parameters:
      listener - Focus Listener