Package net.sf.gridarta.gui.utils
Class MenuUtils
- java.lang.Object
-
- net.sf.gridarta.gui.utils.MenuUtils
-
public class MenuUtils extends java.lang.ObjectUtility class implementing menu related functions.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddisposeMenuElement(@NotNull javax.swing.MenuElement menuElement)Remove all actions attached to menu entries in a given menu element and its children.static @Nullable javax.swing.JMenufindMenu(@NotNull javax.swing.MenuElement menuElement, @NotNull java.lang.String key)Returns aJMenuby action key.static @Nullable javax.swing.JMenugetMenu(@NotNull javax.swing.JMenuBar menuBar, @NotNull java.lang.String name)Returns a namedJMenuentry of aJMenuBar.static voidremoveAll(@NotNull javax.swing.JMenu menu)Remove all menu entries.static voidremoveAllFromSeparator(@NotNull javax.swing.JMenu menu)Remove all menu entries from (but not including) the last separator.static voidremoveAllToSeparator(@NotNull javax.swing.JMenu menu)Remove all menu entries up to (but not including) the first separator.
-
-
-
Method Detail
-
disposeMenuElement
public static void disposeMenuElement(@NotNull @NotNull javax.swing.MenuElement menuElement)Remove all actions attached to menu entries in a given menu element and its children.- Parameters:
menuElement- the menu element to process
-
removeAll
public static void removeAll(@NotNull @NotNull javax.swing.JMenu menu)Remove all menu entries.- Parameters:
menu- the menu to remove the entries from
-
removeAllToSeparator
public static void removeAllToSeparator(@NotNull @NotNull javax.swing.JMenu menu)Remove all menu entries up to (but not including) the first separator.- Parameters:
menu- the menu to remove the entries from
-
removeAllFromSeparator
public static void removeAllFromSeparator(@NotNull @NotNull javax.swing.JMenu menu)Remove all menu entries from (but not including) the last separator.- Parameters:
menu- the menu to remove the entries from
-
getMenu
@Nullable public static @Nullable javax.swing.JMenu getMenu(@NotNull @NotNull javax.swing.JMenuBar menuBar, @NotNull @NotNull java.lang.String name)Returns a namedJMenuentry of aJMenuBar.- Parameters:
menuBar- the menu barname- the name- Returns:
- the menu or
nullif not found
-
findMenu
@Nullable public static @Nullable javax.swing.JMenu findMenu(@NotNull @NotNull javax.swing.MenuElement menuElement, @NotNull @NotNull java.lang.String key)Returns aJMenuby action key.- Parameters:
menuElement- the menu element to search for the action keykey- the action key to search- Returns:
- the menu or
nullif not found
-
-