Package jmri.util.swing
Class JMenuUtil
java.lang.Object
jmri.util.swing.GuiUtilBase
jmri.util.swing.JMenuUtil
public class JMenuUtil extends GuiUtilBase
Common utility methods for working with JMenus.
Chief among these is the loadMenu method, for creating a set of menus from an XML definition
- Since:
- 2.9.4
-
Nested Class Summary
Nested classes/interfaces inherited from class jmri.util.swing.GuiUtilBase
GuiUtilBase.CallingAbstractAction
-
Constructor Summary
Constructors Constructor Description JMenuUtil()
-
Method Summary
Modifier and Type Method Description (package private) static int
convertStringToKeyEvent(String st)
(package private) static JMenu
createMenuGroupFromElement(Element main, WindowInterface wi, Object context)
(package private) static JMenu
jMenuFromElement(Element main, WindowInterface wi, Object context)
static JMenu[]
loadMenu(String path, WindowInterface wi, Object context)
static boolean
replaceMenuItem(JMenuItem orginalMenuItem, JMenuItem replacementMenuItem)
replace a menu item in its parent with another menu item(package private) static void
setMenuItemInterAction(Object context, String ref, JMenuItem menuItem)
Methods inherited from class jmri.util.swing.GuiUtilBase
actionFromNode, createActionInCallingWindow, createEmptyMenuItem, rootFromName, setParameters
-
Constructor Details
-
Method Details
-
loadMenu
-
jMenuFromElement
@Nonnull static JMenu jMenuFromElement(@CheckForNull Element main, WindowInterface wi, Object context) -
createMenuGroupFromElement
@Nonnull static JMenu createMenuGroupFromElement(@CheckForNull Element main, WindowInterface wi, Object context) -
setMenuItemInterAction
-
convertStringToKeyEvent
-
replaceMenuItem
public static boolean replaceMenuItem(@Nonnull JMenuItem orginalMenuItem, @Nonnull JMenuItem replacementMenuItem)replace a menu item in its parent with another menu item(at the same position in the parent menu)
- Parameters:
orginalMenuItem
- the original menu item to be replacedreplacementMenuItem
- the menu item to replace it with- Returns:
- true if the original menu item was found and replaced
-