|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.AbstractAction
de.sciss.gui.MenuAction
public abstract class MenuAction
A simple extension of AbstractAction
that puts a KeyStroke
into its
ACCELERATOR_KEY
field. This field
is read when the action is attached to a
JMenuItem
.
JMenuItem.setAccelerator( KeyStroke )
,
JMenuItem.configurePropertiesFromAction( Action )
,
AbstractButton.setAction( Action )
,
Serialized FormField Summary |
---|
Fields inherited from class javax.swing.AbstractAction |
---|
changeSupport, enabled |
Fields inherited from interface javax.swing.Action |
---|
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON |
Constructor Summary | |
---|---|
MenuAction()
Constructs a new MenuAction
without name and accelerator key. |
|
MenuAction(java.lang.String text)
Constructs a new MenuAction
without accelerator key. |
|
MenuAction(java.lang.String text,
javax.swing.KeyStroke shortcut)
Constructs a new MenuAction with the given
text and accelerator shortcut which will be
used when the action is attached to a JMenuItem . |
Method Summary | |
---|---|
abstract void |
actionPerformed(java.awt.event.ActionEvent e)
|
void |
deinstallFrom(javax.swing.JComponent c,
int condition)
Deinstalls this action from the keyboard input and action map of the given component. |
void |
installOn(javax.swing.JComponent c,
int condition)
Installs this action on the keyboard input and action map of the given component. |
void |
mimic(javax.swing.Action a)
Copies the mappings of a given Action to this Action . |
Methods inherited from class javax.swing.AbstractAction |
---|
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MenuAction(java.lang.String text, javax.swing.KeyStroke shortcut)
MenuAction
with the given
text and accelerator shortcut which will be
used when the action is attached to a JMenuItem
.
text
- text to display in the menu itemshortcut
- KeyStroke
for the
menu item's accelerator or null
public MenuAction(java.lang.String text)
MenuAction
without accelerator key.
text
- text to display in the menu itempublic MenuAction()
MenuAction
without name and accelerator key.
Method Detail |
---|
public void mimic(javax.swing.Action a)
Action
to this Action
.
The entries which are copied are name,
key short cuts and descriptions. Therefore
a menu item carrying this action will look
exactly like the one associated with the
passed in action. Also the enabled flag is
toggled accordingly.
a
- an Action
from which to
copy the mapping entriespublic void installOn(javax.swing.JComponent c, int condition)
c
- the component to install the action oncondition
- either of JComponent.WHEN_FOCUSED
,
JComponent.WHEN_IN_FOCUSED_WINDOW
, or
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
.public void deinstallFrom(javax.swing.JComponent c, int condition)
c
- the component to remove the action fromcondition
- either of JComponent.WHEN_FOCUSED
,
JComponent.WHEN_IN_FOCUSED_WINDOW
, or
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
.public abstract void actionPerformed(java.awt.event.ActionEvent e)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |