Package de.sciss.gui

Class 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.
    See Also:
    AbstractButton.doClick(), Serialized Form
    • Field Summary

      • Fields inherited from class javax.swing.AbstractAction

        changeSupport, enabled
      • Fields inherited from interface javax.swing.Action

        ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
    • Constructor Summary

      Constructors 
      Constructor Description
      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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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
      • Methods inherited from interface javax.swing.Action

        accept
    • Constructor Detail

      • 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.
    • Method Detail

      • 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()