Package 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
AnAbstractActionthat is linked to a button component. Whenever the action is performed, the button'sdoClickmethod is called. This allows theDoClickActionto be used as a global key driven action without the button being necessarily in the focussed window.- See Also:
AbstractButton.doClick(), Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DoClickAction(javax.swing.AbstractButton b)Creates a newDoClickActionfor a given button.DoClickAction(javax.swing.AbstractButton b, javax.swing.KeyStroke stroke)Creates a newDoClickActionfor a given button.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidvalidActionPerformed(java.awt.event.ActionEvent e)Invokes the button'sdoClick()method.-
Methods inherited from class de.sciss.gui.KeyedAction
actionPerformed, getIgnoreFocus, getStroke, setIgnoreFocus
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Constructor Detail
-
DoClickAction
public DoClickAction(javax.swing.AbstractButton b)
Creates a newDoClickActionfor 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 theGUIUtil.createKeyActionmethod, to the button's input / action map.- Parameters:
b- a button whosedoClickmethod 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 newDoClickActionfor 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 additionalKeyStrokewhich is placed in theAbstractAction'sACCELERATOR_KEYfield, this is suitable as aJMenuItem's action or an invisible global key action. An example of this behaviour can be seen in theToolPaletteconstructor which uses theMenuFactory'saddGlobalKeyCommandmethod for its buttons.- Parameters:
b- a button whosedoClickmethod is called when the action is performed.
-
-
Method Detail
-
validActionPerformed
protected void validActionPerformed(java.awt.event.ActionEvent e)
Invokes the button'sdoClick()method.- Specified by:
validActionPerformedin classKeyedAction- See Also:
AbstractButton.doClick()
-
-