public class KeyBindingsTool extends Tool
Tool
which allows to map key strokes occurring on a ViewComponent
to specific
Action
s. Its intention is to provide an easy way to set up key bindings integrating with
the Tool API's flexibility.
Note that, naturally, this Tool
can only react on key events occurring on the
ViewComponent
it is registered for.
Tool.ActivationRequest
DEFAULT_PRIORITY, MAX_PRIORITY, MIN_PRIORITY
Constructor and Description |
---|
KeyBindingsTool() |
Modifier and Type | Method and Description |
---|---|
Action |
getKeyBindingAction(KeyStroke ks)
|
protected void |
handleKeyPressed(KeyEditEvent e,
boolean isActive)
Invoked when a key has been pressed.
|
void |
putKeyBinding(KeyStroke ks,
Action action)
|
Action |
removeKeyBinding(KeyStroke ks)
|
contribute, getActivationFeedback, getActivationRequest, getActivationRequestForKeyPressed, getActivationRequestForMouseDragged, getActivationRequestForMousePressed, getCursor, getDispatchPriority, getManager, getRenderPriority, handleEditEvent, handleKeyReleased, handleKeyTyped, handleMouseClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseMoved, handleMousePressed, handleMouseReleased, handleMouseWheelMoved, propagatePropertyChange, render, setActive, setCursor, setEnabled, setManager, setStatusFeedback
protected void handleKeyPressed(KeyEditEvent e, boolean isActive)
Tool
KeyEvent
for a
definition of a key pressed event.handleKeyPressed
in class Tool
isActive
- whether this tool is currently active@CallOnEDT public void putKeyBinding(KeyStroke ks, Action action)
@CallOnEDT public Action removeKeyBinding(KeyStroke ks)
KeyStroke
's mapping to an Action
. After calling this method,
this Tool
will no longer react upon the given KeyStroke
(until some other key
binding is created using putKeyBinding(KeyStroke, Action)
).Copyright © 2024 levigo holding gmbh. All rights reserved.