javax.swing.text
Interface Keymap

All Known Implementing Classes:
javax.swing.text.JTextComponent.DefaultKeymap

public interface Keymap

Unsafe:


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

Method Detail

getName

public String getName()
Suppressed: Fetches the name of the set of key-bindings.

Returns:
the name

getDefaultAction

public Action getDefaultAction()
Enabled: 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

public void setDefaultAction(Action a)
Enabled: Set the default action to fire if a key is typed.

Parameters:
a - the action

getAction

public Action getAction(KeyStroke key)
Suppressed: 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

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

Returns:
the list of keystrokes

getBoundActions

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

Returns:
the list of actions

getKeyStrokesForAction

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

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

isLocallyDefined

public boolean isLocallyDefined(KeyStroke key)
Enabled: 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

public void addActionForKeyStroke(KeyStroke key,
                                  Action a)
Enabled: Adds a binding to the keymap.

Parameters:
key - the key sequence
a - the action

removeKeyStrokeBinding

public void removeKeyStrokeBinding(KeyStroke keys)
Enabled: Removes a binding from the keymap.

Parameters:
keys - the key sequence

removeBindings

public void removeBindings()
Enabled: Removes all bindings from the keymap.


getResolveParent

public Keymap getResolveParent()
Suppressed: Fetches the parent keymap used to resolve key-bindings.

Returns:
the keymap

setResolveParent

public void setResolveParent(Keymap parent)
Enabled: Sets the parent keymap, which will be used to resolve key-bindings.

Parameters:
parent - the parent keymap


comments?