List of utility methods to do JMenuItem
void | about(JMenuItem anItem) public static void invalidPath() { JOptionPane.showMessageDialog(null, "No se puede salvar un juego dentro de la carpeta " + "'levels'.\nVuelve a intentarlo.", "Error!", JOptionPane.ERROR_MESSAGE); } anItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { JOptionPane.showMessageDialog(null, "Trabajo Practico especial\nProgramacion " + "Orientada a Objetos.\n\nDaniel Lobo - " + "Teresa C. Di Tada - Felipe Martinez\n " + " 2012", "About Sokoban", JOptionPane.INFORMATION_MESSAGE); ... |
void | addIntoMenu(JMenu menu, JMenuItem[] menuItems) Adds JMenuItems into specified JMenu. for (int i = 0; i < menuItems.length; i++) { menu.add(menuItems[i]); |
void | addMenu(JMenu poMenuPadre, JMenuItem poElemento, int piPosicion) add un menbu al menu padre en la posicion correspondiente, si piPosicion es negativo lo inserta por el final int liLongitud = poMenuPadre.getMenuComponentCount(); int liPosSeparador = -1; if (piPosicion < 0) { poMenuPadre.insert(poElemento, (liPosSeparador != -1 ? liPosSeparador : liLongitud) + piPosicion); } else { poMenuPadre.insert(poElemento, (liPosSeparador != -1 ? liPosSeparador : 0) + piPosicion); |
JMenuItem | addMenuItem(final JMenuItem mi, final C topLevelMenu, final List add Menu Item if (path.size() == 0 || path.size() % 2 == 0) throw new IllegalArgumentException("Path should be of the form group/menu/group/... : " + path); JComponent menu = topLevelMenu; for (int i = 0; i < path.size() - 1; i += 2) { final String groupName = path.get(i); final String menuName = path.get(i + 1); menu = addChild(menu, groupName, new JMenu(menuName), JMenu.class, false); final String actionGroupName = path.get(path.size() - 1); return addChild(menu, actionGroupName, mi, JMenuItem.class, true); |
void | aplicarMenu(JMenuItem loMenuO, JMenuItem loMenuD) aplicar Menu loMenuD.setText(loMenuO.getText()); loMenuD.setIcon(loMenuO.getIcon()); loMenuD.setMnemonic(loMenuO.getMnemonic()); loMenuD.setVisible(loMenuO.isVisible()); ActionListener[] lo = loMenuO.getListeners(ActionListener.class); ActionListener[] loD = loMenuD.getListeners(ActionListener.class); for (int i = 0; i < loD.length; i++) { loMenuD.removeActionListener(loD[i]); ... |
void | applyDefaultProperties(final JMenuItem comp) Sets default background and foreground color as well as a default font for the specified component. if (comp == null) { return; applyProperties(comp, "MenuItem.background", "MenuItem.foreground", "MenuItem.font"); |
void | attachAcceleratorKeyNoCtrl(JMenuItem item, int keyEvent) attach Accelerator Key No Ctrl item.setAccelerator(KeyStroke.getKeyStroke(keyEvent, 0)); |
JMenuItem | cloneMenuItem(final JMenuItem item) Creates a copy of this menu item, whose contents update automatically whenever the original menu item changes. if (item == null) return null; JMenuItem jmi; if (item instanceof JMenu) { final JMenu menu = (JMenu) item; final JMenu jm = new JMenu(); final int count = menu.getItemCount(); for (int i = 0; i < count; i++) { ... |
void | configureMenuItem(JMenuItem item, Action action) configure Menu Item KeyStroke keystroke = (KeyStroke) action.getValue(Action.ACCELERATOR_KEY);
if (keystroke != null) {
item.setAccelerator(keystroke);
item.setIcon(null);
item.setToolTipText(null);
|
JMenuItem | createJMenuItem(Action action) Creates a menu item from specified action. JMenuItem item = new JMenuItem(action); item.setActionCommand((String) action.getValue(Action.ACTION_COMMAND_KEY)); return item; |