Package jmri.util.swing
Class JMenuUtil
java.lang.Object
jmri.util.swing.GuiUtilBase
jmri.util.swing.JMenuUtil
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 -
Method Summary
Modifier and TypeMethodDescription(package private) static int(package private) static JMenucreateMenuGroupFromElement(org.jdom2.Element main, WindowInterface wi, Object context) (package private) static JMenujMenuFromElement(org.jdom2.Element main, WindowInterface wi, Object context) static JMenu[]loadMenu(String path, WindowInterface wi, Object context) static booleanreplaceMenuItem(JMenuItem orginalMenuItem, JMenuItem replacementMenuItem) replace a menu item in its parent with another menu item(package private) static voidsetMenuItemInterAction(Object context, String ref, JMenuItem menuItem) Methods inherited from class jmri.util.swing.GuiUtilBase
actionFromNode, createActionInCallingWindow, createEmptyMenuItem, rootFromName, setParameters
-
Constructor Details
-
JMenuUtil
public JMenuUtil()
-
-
Method Details
-
loadMenu
-
jMenuFromElement
@Nonnull static JMenu jMenuFromElement(@CheckForNull org.jdom2.Element main, WindowInterface wi, Object context) -
createMenuGroupFromElement
@Nonnull static JMenu createMenuGroupFromElement(@CheckForNull org.jdom2.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
-