- Enclosing class:
- KeyEvents
public static interface KeyEvents.Builder
A Builder for adding a key event to a component, with a default onKeyRelease trigger
and condition
JComponent.WHEN_FOCUSED
.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptioncondition
(int condition) Sets the key event condition,JComponent.WHEN_FOCUSED
by default.disable
(Collection<JComponent> components) Disables this key event on the given componentsdisable
(JComponent... components) Disables this key event on the given componentsenable
(Collection<JComponent> components) Builds the key event and enables it on the given componentsenable
(JComponent... components) Builds the key event and enables it on the given componentskeyChar
(char keyChar) keyCode
(int keyCode) modifiers
(int modifiers) onKeyRelease
(boolean onKeyRelease) Default false.
-
Method Details
-
keyCode
- Parameters:
keyCode
- the key code- Returns:
- this builder instance
-
keyChar
- Parameters:
keyChar
- the key char- Returns:
- this builder instance
-
modifiers
- Parameters:
modifiers
- the modifiers- Returns:
- this builder instance
-
onKeyRelease
Default false.- Parameters:
onKeyRelease
- true if on key release- Returns:
- this builder instance
-
keyStroke
- Parameters:
keyStroke
- the key stroke- Returns:
- this builder instance
-
condition
Sets the key event condition,JComponent.WHEN_FOCUSED
by default.- Parameters:
condition
- the condition- Returns:
- this builder instance
-
action
- Parameters:
action
- the action, if null then the action binding is removed- Returns:
- this builder instance
-
enable
Builds the key event and enables it on the given components- Parameters:
components
- the components- Returns:
- this builder instance
- Throws:
IllegalStateException
- in case no action has been set
-
enable
Builds the key event and enables it on the given components- Parameters:
components
- the components- Returns:
- this builder instance
- Throws:
IllegalStateException
- in case no action has been set
-
disable
Disables this key event on the given components- Parameters:
components
- the components- Returns:
- this builder instance
- Throws:
IllegalStateException
- in case no action has been set
-
disable
Disables this key event on the given components- Parameters:
components
- the components- Returns:
- this builder instance
- Throws:
IllegalStateException
- in case no action has been set
-