Class GeneiousAction.SubMenu

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
    Enclosing class:
    GeneiousAction

    public static class GeneiousAction.SubMenu
    extends GeneiousAction
    A subclass of GeneiousAction which is placed in the menu as a submenu which opens to the right; In the toolbar, it will appear as a drop-down menu that opens downwards.
    See Also:
    Serialized Form
    • Constructor Detail

      • SubMenu

        public SubMenu​(GeneiousActionOptions actionOptions,
                       java.util.List<GeneiousAction> subMenuActions)
        Parameters:
        actionOptions - GeneiousActionOptions that will determine the properties of the action
        subMenuActions - List of GeneiousActions that will appear in the submenu/popup-menu. Actions will appear in the menu in the same order as they are in this list.
    • Method Detail

      • actionPerformed

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

        public java.util.List<GeneiousAction> getSubMenuActions()
        Get the actions that appear in the submenu/popup-menu, in the same order they will appear in the menu.
        Returns:
        the actions that appear in the submenu/popup-menu, in the same order they will appear in the menu.
      • doPopup

        public javax.swing.JPopupMenu doPopup​(javax.swing.JButton button,
                                              int x,
                                              int y)
        Show the popup represented by this submenu at a specified location relative to the button source. This is automatically called whenever GeneiousAction.asToolbarButton() is clicked., but this method may be useful if the popup needs to be shown at a custom location.
        Parameters:
        button - The button that triggered the popup.
        x - Popup top-left x position relative to the button.
        y - Popup top-left y position relative to the button.
        Returns:
        The popup.
        Since:
        API 4.202200 (Geneious 2022.0.0)
      • constructPopupMenu

        protected javax.swing.JPopupMenu constructPopupMenu()
        This method can be overridden to show a custom JPopupMenu but it is not recommended. It is preferred that instead you create a list of actions you want shown by this submenu and pass them in via the constructor.
        Returns:
        The JPopupMenu shown when this submenu is clicked.
        Since:
        API 4.202110 (Geneious 2021.1.0)
      • getPopupIcons

        public Icons getPopupIcons()
        Get the icons which should be used for this action when it is displayed as a toolbar button. This is usually the same as the Icons specified by the GeneiousActionOptions except with a small black triangle pointing down.
        Returns:
        icons which should be used for this action when it is displayed as a toolbar button.
      • setPopupIcons

        public void setPopupIcons​(Icons popupIcons)
        Set the icons which should be used for this action when it is displayed as a toolbar button.
        Parameters:
        popupIcons - Icons which should be used for this action when it is displayed as a toolbar button.
      • setSubMenuActions

        public void setSubMenuActions​(java.util.List<GeneiousAction> subMenuActions)
        Set the list of actions which will appear in the submenu/popup-menu. They will appear in the same order as they are in the list.
        Parameters:
        subMenuActions - the list of actions which will appear in the submenu/popup-menu.
      • addSubMenuActionsChangedListener

        public void addSubMenuActionsChangedListener​(org.virion.jam.util.SimpleListener listener)
        Add a simple listener to this action which will be fired when the actions in the submenu/popup-menu are changed.
        Parameters:
        listener - SimpleListener which will be fired when the actions in the submenu/popup-menu are changed.
        See Also:
        removeSubMenuActionsChangedListener(org.virion.jam.util.SimpleListener)