List of utility methods to do Swing Menu Item
JMenuItem | addMenuItem(Container menu, String text, ActionListener listener) Add a new menu item to a given menu return addMenuItem(menu, text, listener, null, 0, false);
|
JMenuItem | addMenuItem(final Action action, final C topLevelMenu, final String... path) add Menu Item return addMenuItem(action, topLevelMenu, Arrays.asList(path));
|
void | appendMenuItem(Component menuItem, StringBuilder builder, String indent) append Menu Item if (menuItem instanceof JMenuBar) { appendMenuSubElements((MenuElement) menuItem, builder, indent); } else if (menuItem instanceof JPopupMenu) { appendMenuSubElements((MenuElement) menuItem, builder, indent); } else if (menuItem instanceof JMenuItem) { builder.append(NEWLINE); builder.append(indent); builder.append(((JMenuItem) menuItem).getText()); ... |
JMenu | createMenu(String menu, String[] menuItemNames) create Menu JMenu jmenu = new JMenu(menu); createMenuItems(jmenu, menuItemNames); jmenu.setMnemonic(menu.charAt(0)); return jmenu; |
JMenuItem | createMenuItem(Action a) Creates a JMenuItem from an action. JMenuItem item = new JMenuItem(); item.setAction(a); KeyStroke stroke = (KeyStroke) a.getValue(Action.ACCELERATOR_KEY); if (stroke != null) { item.setAccelerator(stroke); return item; |
JMenuItem | createMenuItem(Action action, Icon icon) Creates a JMenuItem
JMenuItem item = new JMenuItem(action); if (icon != null) { item.setIcon(icon); return item; |
JMenuItem | createMenuItem(ActionListener listener, String cmd, String toolTip) create Menu Item JMenuItem item = new JMenuItem(cmd); item.setActionCommand(cmd); item.addActionListener(listener); item.setToolTipText(toolTip); return item; |
JMenuItem | createMenuItem(final String label, final String accessibleDescription, final ActionListener actionListener) Create a menu item. JMenuItem menuItem = new JMenuItem(label); menuItem.getAccessibleContext().setAccessibleDescription(accessibleDescription); menuItem.addActionListener(actionListener); return menuItem; |
JMenuItem | createMenuItem(final String text, final ActionListener al, final int mnemonic) create Menu Item return createMenuItem(text, al, mnemonic, null);
|
JMenuItem | createMenuItem(final String text, final Icon icon) create Menu Item return new JMenuItem(text, icon); |