public class KeyStrokeConverter extends Object implements Converter
Valild syntax includes:
KeyStroke.getKeyStroke(java.lang.String)
,
ConverterLibrary
Modifier and Type | Field and Description |
---|---|
static Class |
TEMPLATE
converter's return type
|
Constructor and Description |
---|
KeyStrokeConverter() |
Modifier and Type | Method and Description |
---|---|
static Object |
conv(Class type,
Attribute attr,
Localizer localizer)
Converts a String into an KeyStroke.
|
Object |
convert(Class type,
Attribute attr,
Localizer localizer)
Converts a String into an KeyStroke through a Resource lookup
|
Class |
convertsTo()
A
Converters conversTo method informs about the Class type the converter
is returning when its convert method is called |
public static final Class TEMPLATE
public Object convert(Class type, Attribute attr, Localizer localizer)
public static Object conv(Class type, Attribute attr, Localizer localizer)
KeyStroke
.
The string must have the following syntax:
<modifiers>* (<typedID> | <pressedReleasedID>) modifiers := shift | control | ctrl | meta | alt | button1 | button2 | button3 typedID := typed <typedKey> typedKey := string of length 1 giving Unicode character. pressedReleasedID := (pressed | released) key key := KeyEvent key code name, i.e. the name following "VK_".If typed, pressed or released is not specified, pressed is assumed. Here are some examples:
"INSERT" => getKeyStroke(KeyEvent.VK_INSERT, 0); "control DELETE" => getKeyStroke(KeyEvent.VK_DELETE, InputEvent.CTRL_MASK); "alt shift X" => getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK); "alt shift released X" => getKeyStroke(KeyEvent.VK_X, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK, true); "typed a" => getKeyStroke('a');In order to maintain backward-compatibility, specifying a null String, or a String which is formatted incorrectly, returns null.
type
- Class
not usedattr
- Attribute
attribute provides the value to be convertedlocalizer
- Localizer
allow the use of resource lookupsObject
- a KeyStroke
object for that String,
or null if the specified String is null, or is formatted incorrectlypublic Class convertsTo()
Converters
conversTo method informs about the Class type the converter
is returning when its convert
method is calledconvertsTo
in interface Converter
Class
- the Class the converter is returning when its convert method is calledCopyright (c) 2002 - 2014 - Wolf Paulus - wolfpaulus.com. All rights reserved.