javax.swing.text
Interface 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.


Method Summary
 void addActionForKeyStroke sample code for javax.swing.text.Keymap.addActionForKeyStroke(javax.swing.KeyStroke, javax.swing.Action) definition code for javax.swing.text.Keymap.addActionForKeyStroke(javax.swing.KeyStroke, javax.swing.Action) (KeyStroke sample code for javax.swing.KeyStroke definition code for javax.swing.KeyStroke  key, Action sample code for javax.swing.Action definition code for javax.swing.Action  a)
          Adds a binding to the keymap.
 Action sample code for javax.swing.Action definition code for javax.swing.Action getAction sample code for javax.swing.text.Keymap.getAction(javax.swing.KeyStroke) definition code for javax.swing.text.Keymap.getAction(javax.swing.KeyStroke) (KeyStroke sample code for javax.swing.KeyStroke definition code for javax.swing.KeyStroke  key)
          Fetches the action appropriate for the given symbolic event sequence.
 Action sample code for javax.swing.Action definition code for javax.swing.Action [] getBoundActions sample code for javax.swing.text.Keymap.getBoundActions() definition code for javax.swing.text.Keymap.getBoundActions() ()
          Fetches all of the actions defined in this keymap.
 KeyStroke sample code for javax.swing.KeyStroke definition code for javax.swing.KeyStroke [] getBoundKeyStrokes sample code for javax.swing.text.Keymap.getBoundKeyStrokes() definition code for javax.swing.text.Keymap.getBoundKeyStrokes() ()
          Fetches all of the keystrokes in this map that are bound to some action.
 Action sample code for javax.swing.Action definition code for javax.swing.Action getDefaultAction sample code for javax.swing.text.Keymap.getDefaultAction() definition code for javax.swing.text.Keymap.getDefaultAction() ()
          Fetches the default action to fire if a key is typed (i.e.
 KeyStroke sample code for javax.swing.KeyStroke definition code for javax.swing.KeyStroke [] getKeyStrokesForAction sample code for javax.swing.text.Keymap.getKeyStrokesForAction(javax.swing.Action) definition code for javax.swing.text.Keymap.getKeyStrokesForAction(javax.swing.Action) (Action sample code for javax.swing.Action definition code for javax.swing.Action  a)
          Fetches the keystrokes that will result in the given action.
 String sample code for java.lang.String definition code for java.lang.String getName sample code for javax.swing.text.Keymap.getName() definition code for javax.swing.text.Keymap.getName() ()
          Fetches the name of the set of key-bindings.
 Keymap sample code for javax.swing.text.Keymap definition code for javax.swing.text.Keymap getResolveParent sample code for javax.swing.text.Keymap.getResolveParent() definition code for javax.swing.text.Keymap.getResolveParent() ()
          Fetches the parent keymap used to resolve key-bindings.
 boolean isLocallyDefined sample code for javax.swing.text.Keymap.isLocallyDefined(javax.swing.KeyStroke) definition code for javax.swing.text.Keymap.isLocallyDefined(javax.swing.KeyStroke) (KeyStroke sample code for javax.swing.KeyStroke definition code for javax.swing.KeyStroke  key)
          Determines if the given key sequence is locally defined.
 void removeBindings sample code for javax.swing.text.Keymap.removeBindings() definition code for javax.swing.text.Keymap.removeBindings() ()
          Removes all bindings from the keymap.
 void removeKeyStrokeBinding sample code for javax.swing.text.Keymap.removeKeyStrokeBinding(javax.swing.KeyStroke) definition code for javax.swing.text.Keymap.removeKeyStrokeBinding(javax.swing.KeyStroke) (KeyStroke sample code for javax.swing.KeyStroke definition code for javax.swing.KeyStroke  keys)
          Removes a binding from the keymap.
 void setDefaultAction sample code for javax.swing.text.Keymap.setDefaultAction(javax.swing.Action) definition code for javax.swing.text.Keymap.setDefaultAction(javax.swing.Action) (Action sample code for javax.swing.Action definition code for javax.swing.Action  a)
          Set the default action to fire if a key is typed.
 void setResolveParent sample code for javax.swing.text.Keymap.setResolveParent(javax.swing.text.Keymap) definition code for javax.swing.text.Keymap.setResolveParent(javax.swing.text.Keymap) (Keymap sample code for javax.swing.text.Keymap definition code for javax.swing.text.Keymap  parent)
          Sets the parent keymap, which will be used to resolve key-bindings.
 

Method Detail

getName sample code for javax.swing.text.Keymap.getName() definition code for javax.swing.text.Keymap.getName()

String sample code for java.lang.String definition code for java.lang.String  getName()
Fetches the name of the set of key-bindings.

Returns:
the name

getDefaultAction sample code for javax.swing.text.Keymap.getDefaultAction() definition code for javax.swing.text.Keymap.getDefaultAction()

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

Returns:
the default action

setDefaultAction sample code for javax.swing.text.Keymap.setDefaultAction(javax.swing.Action) definition code for javax.swing.text.Keymap.setDefaultAction(javax.swing.Action)

void setDefaultAction(Action sample code for javax.swing.Action definition code for javax.swing.Action  a)
Set the default action to fire if a key is typed.

Parameters:
a - the action

getAction sample code for javax.swing.text.Keymap.getAction(javax.swing.KeyStroke) definition code for javax.swing.text.Keymap.getAction(javax.swing.KeyStroke)

Action sample code for javax.swing.Action definition code for javax.swing.Action  getAction(KeyStroke sample code for javax.swing.KeyStroke definition code for 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.

Parameters:
key - the key sequence
Returns:
the action associated with the key sequence if one is defined, otherwise null

getBoundKeyStrokes sample code for javax.swing.text.Keymap.getBoundKeyStrokes() definition code for javax.swing.text.Keymap.getBoundKeyStrokes()

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

Returns:
the list of keystrokes

getBoundActions sample code for javax.swing.text.Keymap.getBoundActions() definition code for javax.swing.text.Keymap.getBoundActions()

Action sample code for javax.swing.Action definition code for javax.swing.Action [] getBoundActions()
Fetches all of the actions defined in this keymap.

Returns:
the list of actions

getKeyStrokesForAction sample code for javax.swing.text.Keymap.getKeyStrokesForAction(javax.swing.Action) definition code for javax.swing.text.Keymap.getKeyStrokesForAction(javax.swing.Action)

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

Parameters:
a - the action
Returns:
the list of keystrokes

isLocallyDefined sample code for javax.swing.text.Keymap.isLocallyDefined(javax.swing.KeyStroke) definition code for javax.swing.text.Keymap.isLocallyDefined(javax.swing.KeyStroke)

boolean isLocallyDefined(KeyStroke sample code for javax.swing.KeyStroke definition code for javax.swing.KeyStroke  key)
Determines if the given key sequence is locally defined.

Parameters:
key - the key sequence
Returns:
true if the key sequence is locally defined else false

addActionForKeyStroke sample code for javax.swing.text.Keymap.addActionForKeyStroke(javax.swing.KeyStroke, javax.swing.Action) definition code for javax.swing.text.Keymap.addActionForKeyStroke(javax.swing.KeyStroke, javax.swing.Action)

void addActionForKeyStroke(KeyStroke sample code for javax.swing.KeyStroke definition code for javax.swing.KeyStroke  key,
                           Action sample code for javax.swing.Action definition code for javax.swing.Action  a)
Adds a binding to the keymap.

Parameters:
key - the key sequence
a - the action

removeKeyStrokeBinding sample code for javax.swing.text.Keymap.removeKeyStrokeBinding(javax.swing.KeyStroke) definition code for javax.swing.text.Keymap.removeKeyStrokeBinding(javax.swing.KeyStroke)

void removeKeyStrokeBinding(KeyStroke sample code for javax.swing.KeyStroke definition code for javax.swing.KeyStroke  keys)
Removes a binding from the keymap.

Parameters:
keys - the key sequence

removeBindings sample code for javax.swing.text.Keymap.removeBindings() definition code for javax.swing.text.Keymap.removeBindings()

void removeBindings()
Removes all bindings from the keymap.


getResolveParent sample code for javax.swing.text.Keymap.getResolveParent() definition code for javax.swing.text.Keymap.getResolveParent()

Keymap sample code for javax.swing.text.Keymap definition code for javax.swing.text.Keymap  getResolveParent()
Fetches the parent keymap used to resolve key-bindings.

Returns:
the keymap

setResolveParent sample code for javax.swing.text.Keymap.setResolveParent(javax.swing.text.Keymap) definition code for javax.swing.text.Keymap.setResolveParent(javax.swing.text.Keymap)

void setResolveParent(Keymap sample code for javax.swing.text.Keymap definition code for javax.swing.text.Keymap  parent)
Sets the parent keymap, which will be used to resolve key-bindings.

Parameters:
parent - the parent keymap