org.xnap.commons.gui.shortcut
Class ShortcutManager

java.lang.Object
  extended by org.xnap.commons.gui.shortcut.ShortcutManager

public class ShortcutManager
extends Object

Manages Shortcut objects.


Method Summary
 ActionShortcut add(Action action, JComponent c)
          Creates a new ActionShortcut for the action if there isn't already one and returns it.
 void add(Shortcut shortcut)
          Adds a shortcut.
static ShortcutManager getInstance()
          Returns the instance of ShortcutManager.
 Shortcut[] getShortcuts()
          Returns the array of currently registered shorcuts.
 void remove(ActionShortcut shortcut, JComponent c)
          Removes a component from a currently registered action shortcut.
 void remove(Shortcut shortcut)
          Removes a currently registered shortcut.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ShortcutManager getInstance()
Returns the instance of ShortcutManager.


add

public void add(Shortcut shortcut)
Adds a shortcut.


add

public ActionShortcut add(Action action,
                          JComponent c)
Creates a new ActionShortcut for the action if there isn't already one and returns it.

Only one action shortcut object can exist for the same preferences key. Additional components are all managed by the same action shortcut object.

Parameters:
action - the action which should be performed when the shortcut is typed in the respective component
c - the component for which the shortcut and the action are registered

getShortcuts

public Shortcut[] getShortcuts()
Returns the array of currently registered shorcuts.


remove

public void remove(Shortcut shortcut)
Removes a currently registered shortcut.


remove

public void remove(ActionShortcut shortcut,
                   JComponent c)
Removes a component from a currently registered action shortcut.

If the action shortcut's component count ActionShortcut.getNumberOfComponents() drops to 0, it is removed from the shortcut manager.



Copyright © 2004-2007 XNap Commons Team. All Rights Reserved.