public class MenuUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
disposeMenuElement(javax.swing.MenuElement menuElement)
Remove all actions attached to menu entries in a given menu element and
its children.
|
static javax.swing.JMenu |
findMenu(javax.swing.MenuElement menuElement,
java.lang.String key)
Returns a
JMenu by action key. |
static javax.swing.JMenu |
getMenu(javax.swing.JMenuBar menuBar,
java.lang.String name)
Returns a named
JMenu entry of a JMenuBar . |
static void |
removeAll(javax.swing.JMenu menu)
Remove all menu entries.
|
static void |
removeAllFromSeparator(javax.swing.JMenu menu)
Remove all menu entries from (but not including) the last separator.
|
static void |
removeAllToSeparator(javax.swing.JMenu menu)
Remove all menu entries up to (but not including) the first separator.
|
public static void disposeMenuElement(@NotNull javax.swing.MenuElement menuElement)
menuElement
- the menu element to processpublic static void removeAll(@NotNull javax.swing.JMenu menu)
menu
- the menu to remove the entries frompublic static void removeAllToSeparator(@NotNull javax.swing.JMenu menu)
menu
- the menu to remove the entries frompublic static void removeAllFromSeparator(@NotNull javax.swing.JMenu menu)
menu
- the menu to remove the entries from@Nullable public static javax.swing.JMenu getMenu(@NotNull javax.swing.JMenuBar menuBar, @NotNull java.lang.String name)
JMenu
entry of a JMenuBar
.menuBar
- the menu barname
- the namenull
if not found@Nullable public static javax.swing.JMenu findMenu(@NotNull javax.swing.MenuElement menuElement, @NotNull java.lang.String key)
JMenu
by action key.menuElement
- the menu element to search for the action keykey
- the action key to searchnull
if not found