Package qupath.lib.gui.tools
Class MenuTools
java.lang.Object
qupath.lib.gui.tools.MenuTools
Static methods to help with creating and populating JavaFX menus.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionaddMenuItems(List<MenuItem> menuItems, Object... items) Add menu items to the specified list.static MenuaddMenuItems(Menu menu, Object... items) Add menu items to an existing menu.static MenucreateMenu(String name, Object... items) Create a menu, optionally add new menu items withaddMenuItems(List, Object...).getFlattenedMenuItems(boolean excludeMenusAndSeparators, MenuItem... items) Get a flattened list of all menu items recursively.getFlattenedMenuItems(List<? extends MenuItem> menuItems, boolean excludeMenusAndSeparators) Get a flattened list of all menu items recursively.static MenuGet a reference to an existing menu, optionally creating a new menu if it is not present.
- 
Constructor Details- 
MenuToolspublic MenuTools()
 
- 
- 
Method Details- 
createMenuCreate a menu, optionally add new menu items withaddMenuItems(List, Object...).- Parameters:
- name-
- items-
- Returns:
- the newly-created and populated menu
 
- 
addMenuItemsAdd menu items to an existing menu. Items may be- a MenuItem
- an Action
- null(indicating that a separator should be added)
 - Parameters:
- menu- menu to which items should be added
- items- the items that should be provided (MenuItems or Actions, or null to insert a separator)
- Returns:
- the provided menu, so that this method can be nested inside other calls.
 
- a 
- 
addMenuItemsAdd menu items to the specified list. This is similar toaddMenuItems(Menu, Object...)but makes it possible to work also with aContextMenuin addition to a standardMenu.- Parameters:
- menuItems- existing list to which items should be added, or null if a new list should be created
- items- the items that should be provided (MenuItems or Actions, or null to insert a separator)
- Returns:
- the list containing the adding items (same as the original if provided)
 
- 
getMenuGet a reference to an existing menu, optionally creating a new menu if it is not present.- Parameters:
- menus-
- name-
- createMenu-
- Returns:
 
- 
getFlattenedMenuItemspublic static List<MenuItem> getFlattenedMenuItems(List<? extends MenuItem> menuItems, boolean excludeMenusAndSeparators) Get a flattened list of all menu items recursively.- Parameters:
- menuItems- initial list of items (some may themselves be menus)
- excludeMenusAndSeparators- if true, exclude all items that are themselves either menus or separators
- Returns:
 
- 
getFlattenedMenuItemspublic static List<MenuItem> getFlattenedMenuItems(boolean excludeMenusAndSeparators, MenuItem... items) Get a flattened list of all menu items recursively.- Parameters:
- excludeMenusAndSeparators- if true, exclude all items that are themselves either menus or separators
- items- initial array of items (some may themselves be menus)
- Returns:
 
 
-