Class CMenu


public class CMenu extends CDecorateableAction<CommonSimpleMenuAction>
A collection of CActions which are shown in a menu.
Author:
Benjamin Sigg
  • Constructor Details

    • CMenu

      public CMenu()
      Creates a new menu
    • CMenu

      public CMenu(String text, Icon icon)
      Creates a new menu.
      Parameters:
      text - the text of this menu
      icon - the icon of this menu
  • Method Details

    • add

      public void add(CAction action)
      Adds an action to this menu.
      Parameters:
      action - the new action
    • insert

      public void insert(int index, CAction action)
      Adds an action to the menu.
      Parameters:
      index - the location of the action
      action - the new action
    • addSeparator

      public void addSeparator()
      Adds a separator at the end of this menu.
    • insertSeparator

      public void insertSeparator(int index)
      Adds a separator.
      Parameters:
      index - the location of the new separator
    • getActionCount

      public int getActionCount()
      Gets the number of DockActions that were added to this menu.
      Returns:
      the number of actions
    • getAction

      public CAction getAction(int index)
      Gets the index'th action of this menu.
      Parameters:
      index - the index of the action
      Returns:
      the action or null if the index'th DockAction is not a CommonDockAction (and hence no CAction can be found)
    • remove

      public void remove(int index)
      Removes the action at location index.
      Parameters:
      index - the location of the element to remove
    • remove

      public void remove(CAction action)
      Removes an action from this menu
      Parameters:
      action - the action to remove