/** * Support the subscript operator for JMenuBar. * * @param self a JMenuBar * @param index the index of the menu to get * @return the menu at the given index * @since 1.6.4 */ public static JMenu getAt(JMenuBar self, int index) { return self.getMenu(index); }
private void enableAllMenuItems() { for (int i = 0; i < this.mainMenu.getMenuCount(); i++) { enableMenu(this.mainMenu.getMenu(i)); } }
/** * Removes old file list and creates a new file list * with the updated MRU list. */ protected void updateMRUList() { JMenu menu = _logMonitorFrame.getJMenuBar().getMenu(0); menu.removeAll(); menu.add(createOpenMI()); menu.add(createOpenURLMI()); menu.addSeparator(); menu.add(createCloseMI()); createMRUFileListMI(menu); menu.addSeparator(); menu.add(createExitMI()); }
/** * Removes old file list and creates a new file list * with the updated MRU list. */ protected void updateMRUList() { JMenu menu = _logMonitorFrame.getJMenuBar().getMenu(0); menu.removeAll(); menu.add(createOpenMI()); menu.add(createOpenURLMI()); menu.addSeparator(); menu.add(createCloseMI()); createMRUFileListMI(menu); menu.addSeparator(); menu.add(createExitMI()); }
public void setJMenuBar(JMenuBar mBar) { synchronized (mBar) { int mc = mBar.getMenuCount(); for (int i = 0; i < mc; i++) { Utility.getMenuBar().add(mBar.getMenu(i)); } } }
/** * Support the subscript operator for JMenuBar. * * @param self a JMenuBar * @param index the index of the menu to get * @return the menu at the given index * @since 1.6.4 */ public static JMenu getAt(JMenuBar self, int index) { return self.getMenu(index); }
public static JMenu findMenu(JMenuBar menuBar, String menuName) { for (int i = 0; i < menuBar.getMenuCount(); i++) { JMenu menu = menuBar.getMenu(i); if (menuName.equals(menu.getName())) return menu; } return null; }
/** * Support the subscript operator for JMenuBar. * * @param self a JMenuBar * @param index the index of the menu to get * @return the menu at the given index * @since 1.6.4 */ public static JMenu getAt(JMenuBar self, int index) { return self.getMenu(index); }
public static int findMenuPosition(JMenuBar menuBar, String name) { int n = menuBar.getMenuCount(); for (int i = 0; i < n; i++) { JMenu menu = menuBar.getMenu(i); if (name.equals(menu.getName())) { return i; } } return -1; }
/** * Support the subscript operator for JMenuBar. * * @param self a JMenuBar * @param index the index of the menu to get * @return the menu at the given index * @since 1.6.4 */ public static JMenu getAt(JMenuBar self, int index) { return self.getMenu(index); }
public ShortCuts(final JMenuBar menubar) { commands = new ArrayList<String>(); items = new HashMap<String, JMenuItem>(); shortcuts = UniverseSettings.shortcuts; for (int i = 0; i < menubar.getMenuCount(); i++) scan(menubar.getMenu(i), ""); for (final String command : commands) { final String shortcut = shortcuts.get(command); if (shortcut != null) setShortCut(command, shortcut); } }
/** * Returns a {@link MenuItem} component representing a top-level menu (for instance File/Edit/etc.). * That MenuItem can be used then to access the individual menu commands, or other submenus. */ public MenuItem getMenu(String menuName) { int menuIndex = getMenuIndex(menuName); AssertAdapter.assertFalse("Menu '" + menuName + "' does not exist", menuIndex == -1); JMenu menu = jMenuBar.getMenu(menuIndex); return new MenuItem(menu); }
@Override public void populateActions() { for (int i = 0; i < menuBar.getMenuCount(); i++) { JMenu menu = menuBar.getMenu(i); populateActions(menu, menu.getLabel()); } }
private static java.util.Optional<JMenu> getMenu(JMenuBar menuBar, String name) { for (int i = 0; i < menuBar.getMenuCount(); i++) { JMenu menu = menuBar.getMenu(i); if (menu != null) { if (menu.getText() != null) { if (menu.getText().equals(name)) { return java.util.Optional.of(menu); } } } } return java.util.Optional.empty(); }
protected void setMenuBarEnabled( boolean enabled ) { menuBar.setEnabled(enabled); for (int i = 0; i < menuBar.getMenuCount(); i++) { menuBar.getMenu(i).setEnabled(enabled); } }
JMenuBar menubar1 = getJMenuBar(); for (int i = 0; i < menubar1.getMenuCount(); i++) { JMenu menu1 = menubar1.getMenu(i); System.out.println("Menu:" + menu1.getText()); for (int j = 0; j < menu1.getMenuComponentCount(); j++) { java.awt.Component comp = menu1.getMenuComponent(j); if (comp instanceof JMenuItem) { JMenuItem menuItem1 = (JMenuItem) comp; System.out.println("MenuItem:" + menuItem1.getText()); } } }
JMenuBar menubar1 = getJMenuBar(); for (int i = 0; i < menubar1.getMenuCount(); i++) { JMenu menu1 = menubar1.getMenu(i); System.out.println("Menu:" + menu1.getText()); for (int j = 0; j < menu1.getMenuComponentCount(); j++) { java.awt.Component comp = menu1.getMenuComponent(j); if (comp instanceof JMenuItem) { JMenuItem menuItem1 = (JMenuItem) comp; System.out.println("MenuItem:" + menuItem1.getText()); } } }
public JMenu getMenu(String name) { for (int i = 0; i < getJMenuBar().getMenuCount(); i++) { JMenu menu = getJMenuBar().getMenu(i); if (menu.getText() != null) { if (menu.getText().equals(name)) { return menu; } } } JMenu menu = new JMenu(name); getJMenuBar().add(menu); return menu; }