public interface Keymap
Modifier and Type | Method | Description |
---|---|---|
void |
addActionForKeyStroke |
Adds a binding to the keymap. |
Action |
getAction |
Fetches the action appropriate for the given symbolic event sequence. |
Action[] |
getBoundActions() |
Fetches all of the actions defined in this keymap. |
KeyStroke[] |
getBoundKeyStrokes() |
Fetches all of the keystrokes in this map that are bound to some action. |
Action |
getDefaultAction() |
Fetches the default action to fire if a key is typed (i.e. a KEY_TYPED KeyEvent is received) and there is no binding for it. |
KeyStroke[] |
getKeyStrokesForAction |
Fetches the keystrokes that will result in the given action. |
String |
getName() |
Fetches the name of the set of key-bindings. |
Keymap |
getResolveParent() |
Fetches the parent keymap used to resolve key-bindings. |
boolean |
isLocallyDefined |
Determines if the given key sequence is locally defined. |
void |
removeBindings() |
Removes all bindings from the keymap. |
void |
removeKeyStrokeBinding |
Removes a binding from the keymap. |
void |
setDefaultAction |
Set the default action to fire if a key is typed. |
void |
setResolveParent |
Sets the parent keymap, which will be used to resolve key-bindings. |
String getName()
Action getDefaultAction()
void setDefaultAction(Action a)
a
- the actionAction getAction(KeyStroke key)
key
- the key sequencenull
KeyStroke[] getBoundKeyStrokes()
Action[] getBoundActions()
KeyStroke[] getKeyStrokesForAction(Action a)
a
- the actionboolean isLocallyDefined(KeyStroke key)
key
- the key sequencevoid addActionForKeyStroke(KeyStroke key, Action a)
key
- the key sequencea
- the actionvoid removeKeyStrokeBinding(KeyStroke keys)
keys
- the key sequencevoid removeBindings()
Keymap getResolveParent()
void setResolveParent(Keymap parent)
Keymap
has itself as one of its resolve parents.parent
- the parent keymap
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/javax/swing/text/Keymap.html