Package de.sciss.gui

Class MenuAction

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

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

        accept
    • Constructor Detail

      • MenuAction

        public 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.
        Parameters:
        text - text to display in the menu item
        shortcut - KeyStroke for the menu item's accelerator or null
      • MenuAction

        public MenuAction​(java.lang.String text)
        Constructs a new MenuAction without accelerator key.
        Parameters:
        text - text to display in the menu item
      • MenuAction

        public MenuAction()
        Constructs a new MenuAction without name and accelerator key.
    • Method Detail

      • mimic

        public void mimic​(javax.swing.Action a)
        Copies the mappings of a given 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.
        Parameters:
        a - an Action from which to copy the mapping entries
      • installOn

        public void installOn​(javax.swing.JComponent c,
                              int condition)
        Installs this action on the keyboard input and action map of the given component.
        Parameters:
        c - the component to install the action on
        condition - either of JComponent.WHEN_FOCUSED, JComponent.WHEN_IN_FOCUSED_WINDOW, or JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT.
      • deinstallFrom

        public void deinstallFrom​(javax.swing.JComponent c,
                                  int condition)
        Deinstalls this action from the keyboard input and action map of the given component.
        Parameters:
        c - the component to remove the action from
        condition - either of JComponent.WHEN_FOCUSED, JComponent.WHEN_IN_FOCUSED_WINDOW, or JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT.
      • actionPerformed

        public abstract void actionPerformed​(java.awt.event.ActionEvent e)