Class ActionMenuItem

    • Constructor Detail

      • ActionMenuItem

        public ActionMenuItem()
        Default constructor.
      • ActionMenuItem

        public ActionMenuItem​(Icon icon)
        Creates a menu item with the specified icon.
        Parameters:
        icon - the icon.
      • ActionMenuItem

        public ActionMenuItem​(String text)
        Creates a menu item with the specified label.
        Parameters:
        text - the label.
      • ActionMenuItem

        public ActionMenuItem​(String text,
                              Icon icon)
        Creates a menu item with the specified label and icon.
        Parameters:
        text - the label.
        icon - the icon.
      • ActionMenuItem

        public ActionMenuItem​(String text,
                              int i)
        Creates a new menu item with the specified label and mnemonic.
        Parameters:
        text - the label.
        i - the mnemonic.
      • ActionMenuItem

        public ActionMenuItem​(Action action)
        Creates a new menu item based on the specified action.
        Parameters:
        action - the action.
    • Method Detail

      • getAction

        public Action getAction()
        Returns the assigned action or null if no action has been assigned.
        Overrides:
        getAction in class AbstractButton
        Returns:
        the action.
      • setEnabled

        public void setEnabled​(boolean b)
        Enables and disables this button and if an action is assigned to this menuitem the propertychange is forwarded to the assigned action.
        Overrides:
        setEnabled in class JMenuItem
        Parameters:
        b - the new enable-state of this menuitem
      • setAction

        public void setAction​(Action newAction)
        Assigns the given action to this menuitem. The properties of the action will be assigned to the menuitem. If an previous action was set, the old action is unregistered.
        • NAME - specifies the menuitem text
        • SMALL_ICON - specifies the menuitems icon
        • MNEMONIC_KEY - specifies the menuitems mnemonic key
        • ACCELERATOR_KEY - specifies the menuitems accelerator
        Overrides:
        setAction in class AbstractButton
        Parameters:
        newAction - the new action