de.sciss.gui
Class DoClickAction
java.lang.Object
javax.swing.AbstractAction
de.sciss.gui.KeyedAction
de.sciss.gui.DoClickAction
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
public class DoClickAction
- extends KeyedAction
An AbstractAction
that is linked to a button
component. Whenever the action
is performed, the button's
doClick
method
is called. This allows the
DoClickAction
to
be used as a global key driven
action without the button being
necessarily in the focussed window.
- Version:
- 0.16, 05-May-05
- Author:
- Hanns Holger Rutz
- See Also:
AbstractButton.doClick()
,
Serialized Form
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 |
DoClickAction(javax.swing.AbstractButton b)
Creates a new DoClickAction
for a given button. |
DoClickAction(javax.swing.AbstractButton b,
javax.swing.KeyStroke stroke)
Creates a new DoClickAction
for a given button. |
Method Summary |
protected void |
validActionPerformed(java.awt.event.ActionEvent e)
Invokes the button's doClick()
method. |
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 |
DoClickAction
public DoClickAction(javax.swing.AbstractButton b)
- Creates a new
DoClickAction
for a given button. This action
should NOT be attached to this button
because that would produce an infinite feedback
loop. Instead it should be attached to another
object like a menu item or, as in the
GUIUtil.createKeyAction
method,
to the button's input / action map.
- Parameters:
b
- a button whose doClick
method is called when the action
is performed.- See Also:
GUIUtil.createKeyAction( AbstractButton, KeyStroke )
DoClickAction
public DoClickAction(javax.swing.AbstractButton b,
javax.swing.KeyStroke stroke)
- Creates a new
DoClickAction
for a given button. This action
should NOT be attached to this button
because that would produce an infinite feedback
loop. Instead it should be attached to another
object. Since this constructor takes an additional
KeyStroke
which is placed in the
AbstractAction
's ACCELERATOR_KEY
field, this is suitable as a JMenuItem
's
action or an invisible global key action. An example
of this behaviour can be seen in the ToolPalette
constructor which uses the MenuFactory
's
addGlobalKeyCommand
method for its buttons.
- Parameters:
b
- a button whose doClick
method is called when the action
is performed.
validActionPerformed
protected void validActionPerformed(java.awt.event.ActionEvent e)
- Invokes the button's
doClick()
method.
- Specified by:
validActionPerformed
in class KeyedAction
- See Also:
AbstractButton.doClick()