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.
-
Nested Class Summary
Nested classes/interfaces inherited from class VASSAL.configure.Configurer
Configurer.ContextLevel
-
Field Summary
Fields inherited from class VASSAL.configure.Configurer
changeSupport, context, contextLevel, frozen, hint, key, LIST_ENTRY_HIGHLIGHT_COLOR, name, NAME_PROPERTY, noUpdate, value
-
Constructor Summary
ConstructorDescriptionNamedHotKeyConfigurer
(String key, String name) NamedHotKeyConfigurer
(String key, String name, NamedKeyStroke val) NamedHotKeyConfigurer
(String key, String name, NamedKeyStroke val, int defaultFieldLength) NamedHotKeyConfigurer
(NamedKeyStroke val, int defaultFieldLength) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFocusListener
(FocusListener listener) Add a FocusListener to the Swing Components that make up this Configurer.static NamedKeyStroke
Decode a String into a NamedKeyStrokestatic String
encode
(NamedKeyStroke stroke) Encode a NamedKeyStroke into a Stringvoid
void
GUI interface for setting the option in an editing windowstatic String
static String
Return a string representation of a KeyStrokestatic String
Return a String representation of a NamedKeyStrokeboolean
isNamed()
protected boolean
isPrintableAscii
(char c) protected boolean
isPrintableAscii
(int i) void
removeFocusListener
(FocusListener listener) Remove a FocusListener from the Swing Components that make up this Configurer.void
Move the cursor to the first input field of this Configurervoid
setHighlighted
(boolean highlighted) Set the highlighted status of this configurer.void
Set the Object valuevoid
Set the Object value from a Stringprotected void
Methods inherited from class VASSAL.configure.Configurer
addPropertyChangeListener, fireUpdate, getContext, getContextLevel, getHint, getKey, getName, getScreenSize, getValue, initCustomControls, isFrozen, isHighlighted, isPieceContext, removePropertyChangeListener, repack, repack, setContext, setContext, setContext, setContextLevel, setEnabled, setFrozen, setHint, setHintKey, setLabelVisibile, setLabelVisible, setName
-
Constructor Details
-
NamedHotKeyConfigurer
-
NamedHotKeyConfigurer
-
NamedHotKeyConfigurer
-
NamedHotKeyConfigurer
-
NamedHotKeyConfigurer
-
NamedHotKeyConfigurer
public NamedHotKeyConfigurer()
-
-
Method Details
-
getFancyString
-
getString
Return a String representation of a NamedKeyStroke- Parameters:
k
- NamedKeyStroke- Returns:
- String representation
-
getString
-
getValueString
- Specified by:
getValueString
in classConfigurer
- Returns:
- a String representation of the Object value
-
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 classConfigurer
-
setValue
Description copied from class:Configurer
Set the Object value- Overrides:
setValue
in classConfigurer
-
updateVisibility
protected void updateVisibility() -
setValue
Description copied from class:Configurer
Set the Object value from a String- Specified by:
setValue
in classConfigurer
-
getControls
Description copied from class:Configurer
GUI interface for setting the option in an editing window- Specified by:
getControls
in classConfigurer
-
focusGained
- Specified by:
focusGained
in interfaceFocusListener
-
focusLost
- Specified by:
focusLost
in 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: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 classConfigurer
- Parameters:
highlighted
- New Highlighted status
-
addFocusListener
Description copied from class:Configurer
Add a FocusListener to the Swing Components that make up this Configurer.- Overrides:
addFocusListener
in classConfigurer
- Parameters:
listener
- Focus Listener
-
removeFocusListener
Description copied from class:Configurer
Remove a FocusListener from the Swing Components that make up this Configurer.- Overrides:
removeFocusListener
in classConfigurer
- Parameters:
listener
- Focus Listener
-