Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Interface java.awt.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.


Method Summary
void  addActionForKeyStroke(KeyStroke key, Action a)
Adds a binding to the keymap.
Action  getAction(KeyStroke key)
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()
Fetch the default action to fire if a key is typed (ie a KEY_TYPED KeyEvent is received) and there is no binding for it.
KeyStroke[]  getKeyStrokesForAction(Action a)
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(KeyStroke key)
Determines if the given key sequence is locally defined.
void  removeBindings()
Removes all bindings from the keymap.
void  removeKeyStrokeBinding(KeyStroke keys)
Removes a binding from the keymap.
void  setDefaultAction(Action a)
Set the default action to fire if a key is typed.
void  setResolveParent(Keymap parent)
Sets the parent keymap, which will be used to resolve key-bindings.
 

Method Detail

getName

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

getDefaultAction

public Action getDefaultAction()
Fetch the default action to fire if a key is typed (ie 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.

setDefaultAction

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

getAction

public Action getAction(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

getBoundKeyStrokes

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

getBoundActions

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

getKeyStrokesForAction

public KeyStroke[] getKeyStrokesForAction(Action a)
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)
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)
Adds a binding to the keymap.
Parameters:
key - the key sequence
a - the action

removeKeyStrokeBinding

public void removeKeyStrokeBinding(KeyStroke keys)
Removes a binding from the keymap.
Parameters:
keys - the key sequence

removeBindings

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

getResolveParent

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

setResolveParent

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

Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.