public class DefaultInputHandler extends InputHandler
InputHandler.backspace, InputHandler.backspace_word, InputHandler.delete, InputHandler.delete_word, InputHandler.document_end, InputHandler.document_home, InputHandler.end, InputHandler.home, InputHandler.insert_break, InputHandler.insert_char, InputHandler.insert_tab, InputHandler.MacroRecorder, InputHandler.next_char, InputHandler.next_line, InputHandler.next_page, InputHandler.next_word, InputHandler.NonRecordable, InputHandler.NonRepeatable, InputHandler.overwrite, InputHandler.prev_char, InputHandler.prev_line, InputHandler.prev_page, InputHandler.prev_word, InputHandler.redo, InputHandler.repeat, InputHandler.select_all, InputHandler.shift_left, InputHandler.shift_right, InputHandler.toggle_rect, InputHandler.undo, InputHandler.Wrapper
BACKSPACE, BACKSPACE_WORD, DELETE, DELETE_WORD, DOCUMENT_END, DOCUMENT_HOME, END, grabAction, HOME, INSERT_BREAK, INSERT_CHAR, INSERT_TAB, NEXT_CHAR, NEXT_LINE, NEXT_PAGE, NEXT_WORD, OVERWRITE, PREV_CHAR, PREV_LINE, PREV_PAGE, PREV_WORD, recorder, REDO, repeat, REPEAT, repeatCount, SELECT_ALL, SELECT_DOC_END, SELECT_DOC_HOME, SELECT_END, SELECT_HOME, SELECT_NEXT_CHAR, SELECT_NEXT_LINE, SELECT_NEXT_PAGE, SELECT_NEXT_WORD, SELECT_PREV_CHAR, SELECT_PREV_LINE, SELECT_PREV_PAGE, SELECT_PREV_WORD, SHIFT_LEFT, SHIFT_RIGHT, SMART_HOME_END_PROPERTY, TOGGLE_RECT, UNDO
Constructor and Description |
---|
DefaultInputHandler()
Creates a new input handler with no key bindings defined.
|
Modifier and Type | Method and Description |
---|---|
void |
addDefaultKeyBindings()
Sets up the default key bindings.
|
void |
addKeyBinding(java.lang.String keyBinding,
java.awt.event.ActionListener action)
Adds a key binding to this input handler.
|
InputHandler |
copy()
Returns a copy of this input handler that shares the same
key bindings.
|
void |
keyPressed(java.awt.event.KeyEvent evt)
Handle a key pressed event.
|
void |
keyTyped(java.awt.event.KeyEvent evt)
Handle a key typed event.
|
static javax.swing.KeyStroke |
parseKeyStroke(java.lang.String keyStroke)
Converts a string to a keystroke.
|
void |
removeAllKeyBindings()
Removes all key bindings from this input handler.
|
void |
removeKeyBinding(java.lang.String keyBinding)
Removes a key binding from this input handler.
|
executeAction, getAction, getActionName, getActions, getMacroRecorder, getRepeatCount, getTextArea, grabNextKeyStroke, handleGrabAction, isRepeatEnabled, setMacroRecorder, setRepeatCount, setRepeatEnabled
public DefaultInputHandler()
public void addDefaultKeyBindings()
addDefaultKeyBindings
in class InputHandler
public void addKeyBinding(java.lang.String keyBinding, java.awt.event.ActionListener action)
addKeyBinding
in class InputHandler
keyBinding
- The key bindingaction
- The actionpublic void removeKeyBinding(java.lang.String keyBinding)
removeKeyBinding
in class InputHandler
keyBinding
- The key bindingpublic void removeAllKeyBindings()
removeAllKeyBindings
in class InputHandler
public InputHandler copy()
copy
in class InputHandler
public void keyPressed(java.awt.event.KeyEvent evt)
keyPressed
in interface java.awt.event.KeyListener
keyPressed
in class java.awt.event.KeyAdapter
evt
- the KeyEventpublic void keyTyped(java.awt.event.KeyEvent evt)
keyTyped
in interface java.awt.event.KeyListener
keyTyped
in class java.awt.event.KeyAdapter
evt
- the KeyEventpublic static javax.swing.KeyStroke parseKeyStroke(java.lang.String keyStroke)
KeyEvent
class, without
the
VK_
prefix.keyStroke
- A string description of the key strokeCopyright © 2016, 2017, 2018, 2019, 2023 Herve Girod. All Rights Reserved. Documentation and source under the MIT licence