public abstract class InputHandler extends java.awt.event.KeyAdapter
An input handler converts the user's key strokes into concrete actions. It also takes care of macro recording and action repetition.
This class provides all the necessary support code for an input handler, but doesn't actually do any key binding logic. It is up to the implementations of this class to do so.Modifiers | Name | Description |
---|---|---|
static java.awt.event.ActionListener |
BACKSPACE |
|
static java.awt.event.ActionListener |
BACKSPACE_WORD |
|
static javax.swing.Action |
CLIP_COPY |
|
static javax.swing.Action |
CLIP_CUT |
|
static javax.swing.Action |
CLIP_PASTE |
|
static java.awt.event.ActionListener |
DELETE |
|
static java.awt.event.ActionListener |
DELETE_WORD |
|
static java.awt.event.ActionListener |
DOCUMENT_END |
|
static java.awt.event.ActionListener |
DOCUMENT_HOME |
|
static java.awt.event.ActionListener |
END |
|
static java.awt.event.ActionListener |
HOME |
|
static java.awt.event.ActionListener |
INSERT_BREAK |
|
static java.awt.event.ActionListener |
INSERT_CHAR |
|
static java.awt.event.ActionListener |
INSERT_TAB |
|
static java.awt.event.ActionListener |
NEXT_CHAR |
|
static java.awt.event.ActionListener |
NEXT_LINE |
|
static java.awt.event.ActionListener |
NEXT_PAGE |
|
static java.awt.event.ActionListener |
NEXT_WORD |
|
static java.awt.event.ActionListener |
OVERWRITE |
|
static java.awt.event.ActionListener |
PREV_CHAR |
|
static java.awt.event.ActionListener |
PREV_LINE |
|
static java.awt.event.ActionListener |
PREV_PAGE |
|
static java.awt.event.ActionListener |
PREV_WORD |
|
static java.awt.event.ActionListener |
REPEAT |
|
static java.awt.event.ActionListener |
SELECT_ALL |
|
static java.awt.event.ActionListener |
SELECT_DOC_END |
|
static java.awt.event.ActionListener |
SELECT_DOC_HOME |
|
static java.awt.event.ActionListener |
SELECT_END |
|
static java.awt.event.ActionListener |
SELECT_HOME |
|
static java.awt.event.ActionListener |
SELECT_NEXT_CHAR |
|
static java.awt.event.ActionListener |
SELECT_NEXT_LINE |
|
static java.awt.event.ActionListener |
SELECT_NEXT_PAGE |
|
static java.awt.event.ActionListener |
SELECT_NEXT_WORD |
|
static java.awt.event.ActionListener |
SELECT_PREV_CHAR |
|
static java.awt.event.ActionListener |
SELECT_PREV_LINE |
|
static java.awt.event.ActionListener |
SELECT_PREV_PAGE |
|
static java.awt.event.ActionListener |
SELECT_PREV_WORD |
|
static java.lang.String |
SMART_HOME_END_PROPERTY |
If this client property is set to Boolean.TRUE on the text area, the home/end keys will support 'smart' BRIEF-like behaviour (one press = start/end of line, two presses = start/end of viewscreen, three presses = start/end of document). |
static java.awt.event.ActionListener |
TOGGLE_RECT |
Type Params | Return Type | Name and description |
---|---|---|
|
public abstract void |
addDefaultKeyBindings() Adds the default key bindings to this input handler. |
|
public abstract void |
addKeyBinding(java.lang.String keyBinding, java.awt.event.ActionListener action) Adds a key binding to this input handler. |
|
public abstract InputHandler |
copy() Returns a copy of this input handler that shares the same key bindings. |
|
public void |
executeAction(java.awt.event.ActionListener listener, java.lang.Object source, java.lang.String actionCommand) Executes the specified action, repeating and recording it as necessary. |
|
public static java.awt.event.ActionListener |
getAction(java.lang.String name) Returns a named text area action. |
|
public static java.lang.String |
getActionName(java.awt.event.ActionListener listener) Returns the name of the specified text area action. |
|
public static java.util.Enumeration |
getActions() Returns an enumeration of all available actions. |
|
public MacroRecorder |
getMacroRecorder() Returns the macro recorder. |
|
public static int |
getMenuShortcutKeyMask() |
|
public int |
getRepeatCount() Returns the number of times the next action will be repeated. |
|
public static JEditTextArea |
getTextArea(java.util.EventObject evt) Returns the text area that fired the specified event. |
|
public void |
grabNextKeyStroke(java.awt.event.ActionListener listener) Grabs the next key typed event and invokes the specified action with the key as a the action command. |
|
public boolean |
isRepeatEnabled() Returns if repeating is enabled. |
|
public abstract void |
removeAllKeyBindings() Removes all key bindings from this input handler. |
|
public abstract void |
removeKeyBinding(java.lang.String keyBinding) Removes a key binding from this input handler. |
|
public void |
setMacroRecorder(MacroRecorder recorder) Sets the macro recorder. |
|
public void |
setRepeatCount(int repeatCount) Sets the number of times the next action will be repeated. |
|
public void |
setRepeatEnabled(boolean repeat) Enables repeating. |
|
public static void |
useCtrlKeyInsteadOfMenuKey(boolean b) |
Methods inherited from class | Name |
---|---|
class java.awt.event.KeyAdapter |
java.awt.event.KeyAdapter#keyTyped(java.awt.event.KeyEvent), java.awt.event.KeyAdapter#keyPressed(java.awt.event.KeyEvent), java.awt.event.KeyAdapter#keyReleased(java.awt.event.KeyEvent), java.awt.event.KeyAdapter#wait(long, int), java.awt.event.KeyAdapter#wait(), java.awt.event.KeyAdapter#wait(long), java.awt.event.KeyAdapter#equals(java.lang.Object), java.awt.event.KeyAdapter#toString(), java.awt.event.KeyAdapter#hashCode(), java.awt.event.KeyAdapter#getClass(), java.awt.event.KeyAdapter#notify(), java.awt.event.KeyAdapter#notifyAll() |
If this client property is set to Boolean.TRUE on the text area, the home/end keys will support 'smart' BRIEF-like behaviour (one press = start/end of line, two presses = start/end of viewscreen, three presses = start/end of document). By default, this property is not set.
Adds the default key bindings to this input handler. This should not be called in the constructor of this input handler, because applications might load the key bindings from a file, etc.
Adds a key binding to this input handler.
keyBinding
- The key binding (the format of this is input-handler specific)action
- The actionReturns a copy of this input handler that shares the same key bindings. Setting key bindings in the copy will also set them in the original.
Executes the specified action, repeating and recording it as necessary.
listener
- The action listenersource
- The event sourceactionCommand
- The action commandReturns a named text area action.
name
- The action nameReturns the name of the specified text area action.
listener
- The actionReturns an enumeration of all available actions.
Returns the macro recorder. If this is non-null, all executed actions should be forwarded to the recorder.
Returns the number of times the next action will be repeated.
Returns the text area that fired the specified event.
evt
- The eventGrabs the next key typed event and invokes the specified action with the key as a the action command.
action
- The actionReturns if repeating is enabled. When repeating is enabled, actions will be executed multiple times. This is usually invoked with a special key stroke in the input handler.
Removes all key bindings from this input handler.
Removes a key binding from this input handler.
keyBinding
- The key bindingSets the macro recorder. If this is non-null, all executed actions should be forwarded to the recorder.
recorder
- The macro recorderSets the number of times the next action will be repeated.
repeatCount
- The repeat countEnables repeating. When repeating is enabled, actions will be executed multiple times. Once repeating is enabled, the input handler should read a number from the keyboard.