Package VASSAL.configure
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.
-
Field Summary
Fields inherited from class VASSAL.configure.Configurer
changeSupport, frozen, hint, key, name, NAME_PROPERTY, noUpdate, value -
Constructor Summary
Constructors Constructor Description NamedHotKeyConfigurer(String key, String name)NamedHotKeyConfigurer(String key, String name, NamedKeyStroke val)NamedHotKeyConfigurer(NamedKeyStroke val) -
Method Summary
Modifier and Type Method Description static NamedKeyStrokedecode(String s)Decode a String into a NamedKeyStrokestatic Stringencode(NamedKeyStroke stroke)Encode a NamedKeyStroke into a StringvoidfocusGained(FocusEvent e)voidfocusLost(FocusEvent e)ComponentgetControls()GUI interface for setting the option in an editing windowstatic StringgetFancyString(NamedKeyStroke k)static StringgetString(KeyStroke k)Return a string representation of a KeyStrokestatic StringgetString(NamedKeyStroke k)Return a String representation of a NamedKeyStrokeNamedKeyStrokegetValueNamedKeyStroke()StringgetValueString()booleanisNamed()protected booleanisPrintableAscii(char c)protected booleanisPrintableAscii(int i)StringkeyToString()voidsetValue(Object o)Set the Object valuevoidsetValue(String s)Set the Object value from a Stringprotected voidupdateVisibility()Methods inherited from class VASSAL.configure.Configurer
addPropertyChangeListener, fireUpdate, getHint, getKey, getName, getScreenSize, getValue, isFrozen, removePropertyChangeListener, repack, repack, setFrozen, setHint, setLabelVisibile, setName
-
Constructor Details
-
NamedHotKeyConfigurer
-
NamedHotKeyConfigurer
-
NamedHotKeyConfigurer
-
-
Method Details
-
getFancyString
-
getString
Return a String representation of a NamedKeyStroke- Parameters:
k- NamedKeyStroke- Returns:
- String representation
-
getString
Return a string representation of a KeyStroke- Parameters:
k- KeyStroke- Returns:
- String representation
-
getValueString
- Specified by:
getValueStringin classConfigurer- Returns:
- a String representation of the Object value
-
getValueNamedKeyStroke
-
isNamed
public boolean isNamed() -
setValue
Description copied from class:ConfigurerSet the Object value- Overrides:
setValuein classConfigurer
-
updateVisibility
protected void updateVisibility() -
setValue
Description copied from class:ConfigurerSet the Object value from a String- Specified by:
setValuein classConfigurer
-
getControls
Description copied from class:ConfigurerGUI interface for setting the option in an editing window- Specified by:
getControlsin classConfigurer
-
focusGained
- Specified by:
focusGainedin interfaceFocusListener
-
focusLost
- Specified by:
focusLostin interfaceFocusListener
-
keyToString
-
isPrintableAscii
protected boolean isPrintableAscii(char c) -
isPrintableAscii
protected boolean isPrintableAscii(int i) -
decode
Decode a String into a NamedKeyStroke -
encode
Encode a NamedKeyStroke into a String
-