Module is.codion.swing.common.ui
Package is.codion.swing.common.ui.key
Interface KeyboardShortcuts<T extends Enum<T>>
- Type Parameters:
T
- the shortcut key type
public interface KeyboardShortcuts<T extends Enum<T>>
Holds keyboard shortcut keyStrokes, mapped to enum based shortcut keys.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptioncopy()
static <T extends Enum<T>>
KeyboardShortcuts<T>keyboardShortcuts
(Class<T> shortcutKeyClass, Function<T, KeyStroke> defaultKeyStrokes) static KeyStroke
keyStroke
(int keyCode) Creates aKeyStroke
with the given keyCode and no modifiers.static KeyStroke
keyStroke
(int keyCode, int modifiers) Creates aKeyStroke
with the given keyCode and modifiers.
-
Method Details
-
keyStroke
- Parameters:
keyboardShortcut
- the shortcut key- Returns:
- the
Value
controlling the key stroke for the given shortcut key
-
copy
KeyboardShortcuts<T> copy()- Returns:
- a copy of this
KeyboardShortcuts
instance
-
keyboardShortcuts
static <T extends Enum<T>> KeyboardShortcuts<T> keyboardShortcuts(Class<T> shortcutKeyClass, Function<T, KeyStroke> defaultKeyStrokes) - Type Parameters:
T
- the shortcut key type- Parameters:
shortcutKeyClass
- the shortcut key classdefaultKeyStrokes
- provides the default keystroke for each shortcut key- Returns:
- a new
KeyboardShortcuts
instance - Throws:
IllegalStateException
- in case the default keyStrokes function does not provide keyStrokes for all shortcut keys
-
keyStroke
Creates aKeyStroke
with the given keyCode and no modifiers.- Parameters:
keyCode
- the key code- Returns:
- a keystroke value
- See Also:
-
keyStroke
Creates aKeyStroke
with the given keyCode and modifiers.- Parameters:
keyCode
- the key codemodifiers
- the modifiers- Returns:
- a keystroke value
- See Also:
-