List of utility methods to do Swing Menu Item
JMenuItem | createMenuItem(String caption, Action action) Create menu item. JMenuItem menuItem = new JMenuItem(caption); menuItem.addActionListener(action); return menuItem; |
JMenuItem | createMenuItem(String menuItemName, ActionListener actionListener) create Menu Item JMenuItem menuItem = new JMenuItem(menuItemName); menuItem.addActionListener(actionListener); return menuItem; |
JMenuItem | createMenuItem(String menuText, ActionListener listener) create Menu Item JMenuItem menuItem = new JMenuItem(menuText); menuItem.addActionListener(listener); return menuItem; |
JMenuItem | createMenuitem(String name, ActionListener listener) create Menuitem final JMenuItem button = new JMenuItem(name); button.addActionListener(listener); return button; |
JMenuItem | createMenuItem(String name, String description, int mnemonic, int accelerator, ActionListener listener) Makes a new menu item. JMenuItem item = new JMenuItem(name, mnemonic); item.getAccessibleContext().setAccessibleDescription(description); item.setAccelerator( KeyStroke.getKeyStroke(accelerator, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); item.addActionListener(listener); return item; |
JMenuItem | createMenuItem(String strTitle, String strActionCommand, ActionListener alListener) Create a popup menu item JMenuItem deleteItem = new JMenuItem(); if (strTitle != null && !strTitle.isEmpty()) { deleteItem.setText(strTitle); if (strActionCommand != null && !strActionCommand.isEmpty()) { deleteItem.setActionCommand(strActionCommand); if (alListener != null) { ... |
JMenuItem | createMenuItem(String text, boolean visible) create Menu Item JMenuItem item = new JMenuItem(text); item.setVisible(visible); return item; |
JMenuItem | createMenuItem(String text, Icon icon, String toolTip, ActionListener... listeners) create Menu Item JMenuItem result = new JMenuItem(text, icon); if (toolTip != null) { result.setToolTipText(toolTip); for (ActionListener listener : listeners) { result.addActionListener(listener); return result; ... |
T | createMenuItem(T source, int mnemonic, String description, E action) create Menu Item source.setMnemonic(mnemonic); source.getAccessibleContext().setAccessibleDescription(description); if (action instanceof ActionListener) { source.addActionListener((ActionListener) action); } else if (action instanceof ItemListener) { source.addItemListener((ItemListener) action); return source; ... |
JRadioButtonMenuItem | createRadioButtonMenuItem(final String text, final boolean selected) create Radio Button Menu Item return new JRadioButtonMenuItem(text, selected); |