FileDocCategorySizeDatePackage
Keymap.javaAPI DocJava SE 5 API3290Fri Aug 26 14:58:16 BST 2005javax.swing.text

Keymap

public interface Keymap
A collection of bindings of KeyStrokes to actions. The bindings are basically name-value pairs that potentially resolve in a hierarchy.
author
Timothy Prinzing
version
1.18 12/19/03

Fields Summary
Constructors Summary
Methods Summary
public voidaddActionForKeyStroke(javax.swing.KeyStroke key, javax.swing.Action a)
Adds a binding to the keymap.

param
key the key sequence
param
a the action

public javax.swing.ActiongetAction(javax.swing.KeyStroke key)
Fetches the action appropriate for the given symbolic event sequence. This is used by JTextController to determine how to interpret key sequences. If the binding is not resolved locally, an attempt is made to resolve through the parent keymap, if one is set.

param
key the key sequence
return
the action associated with the key sequence if one is defined, otherwise null

public javax.swing.Action[]getBoundActions()
Fetches all of the actions defined in this keymap.

return
the list of actions

public javax.swing.KeyStroke[]getBoundKeyStrokes()
Fetches all of the keystrokes in this map that are bound to some action.

return
the list of keystrokes

public javax.swing.ActiongetDefaultAction()
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. Typically this would be some action that inserts text so that the keymap doesn't require an action for each possible key.

return
the default action

public javax.swing.KeyStroke[]getKeyStrokesForAction(javax.swing.Action a)
Fetches the keystrokes that will result in the given action.

param
a the action
return
the list of keystrokes

public java.lang.StringgetName()
Fetches the name of the set of key-bindings.

return
the name

public javax.swing.text.KeymapgetResolveParent()
Fetches the parent keymap used to resolve key-bindings.

return
the keymap

public booleanisLocallyDefined(javax.swing.KeyStroke key)
Determines if the given key sequence is locally defined.

param
key the key sequence
return
true if the key sequence is locally defined else false

public voidremoveBindings()
Removes all bindings from the keymap.

public voidremoveKeyStrokeBinding(javax.swing.KeyStroke keys)
Removes a binding from the keymap.

param
keys the key sequence

public voidsetDefaultAction(javax.swing.Action a)
Set the default action to fire if a key is typed.

param
a the action

public voidsetResolveParent(javax.swing.text.Keymap parent)
Sets the parent keymap, which will be used to resolve key-bindings.

param
parent the parent keymap