Package VASSAL.configure
Class NamedHotKeyConfigurer
java.lang.Object
VASSAL.configure.Configurer
VASSAL.configure.NamedHotKeyConfigurer
- All Implemented Interfaces:
FocusListener,EventListener
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, LIST_ENTRY_HIGHLIGHT_COLOR, name, NAME_PROPERTY, noUpdate, value -
Constructor Summary
ConstructorsConstructorDescriptionNamedHotKeyConfigurer(String key, String name)NamedHotKeyConfigurer(String key, String name, NamedKeyStroke val) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFocusListener(FocusListener listener)Add a FocusListener to the Swing Components that make up this Configurer.static NamedKeyStrokeDecode a String into a NamedKeyStrokestatic Stringencode(NamedKeyStroke stroke)Encode a NamedKeyStroke into a StringvoidvoidfocusLost(FocusEvent e)GUI interface for setting the option in an editing windowstatic Stringstatic StringReturn a string representation of a KeyStrokestatic StringReturn a String representation of a NamedKeyStrokebooleanisNamed()protected booleanisPrintableAscii(char c)protected booleanisPrintableAscii(int i)voidremoveFocusListener(FocusListener listener)Remove a FocusListener from the Swing Components that make up this Configurer.voidMove the cursor to the first input field of this ConfigurervoidsetHighlighted(boolean highlighted)Set the highlighted status of this configurer.voidSet the Object valuevoidSet the Object value from a Stringprotected voidMethods inherited from class VASSAL.configure.Configurer
addPropertyChangeListener, fireUpdate, getHint, getKey, getName, getScreenSize, getValue, isFrozen, isHighlighted, removePropertyChangeListener, repack, repack, setFrozen, setHint, setHintKey, setLabelVisibile, setName
-
Constructor Details
-
NamedHotKeyConfigurer
-
NamedHotKeyConfigurer
-
NamedHotKeyConfigurer
-
NamedHotKeyConfigurer
public 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() -
requestFocus
public void requestFocus()Description copied from class:ConfigurerMove the cursor to the first input field of this Configurer- Overrides:
requestFocusin classConfigurer
-
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 -
setHighlighted
public void setHighlighted(boolean highlighted)Description copied from class:ConfigurerSet the highlighted status of this configurer. It is up to individual Configurers to over-ride this method and implement a suitable visual highlighting scheme Note: Cannot make this abstract as it will break custom code.- Overrides:
setHighlightedin classConfigurer- Parameters:
highlighted- New Highlighted status
-
addFocusListener
Description copied from class:ConfigurerAdd a FocusListener to the Swing Components that make up this Configurer.- Overrides:
addFocusListenerin classConfigurer- Parameters:
listener- Focus Listener
-
removeFocusListener
Description copied from class:ConfigurerRemove a FocusListener from the Swing Components that make up this Configurer.- Overrides:
removeFocusListenerin classConfigurer- Parameters:
listener- Focus Listener
-