List of usage examples for javax.swing JMenu getMenuComponent
public Component getMenuComponent(int n)
n
. From source file:org.jcurl.demo.smack.JCurlSmackClient.java
private JMenuBar createMenuBar() { final JMenuBar menuBar = new JMenuBar(); final String[] xmppMenuActionNames = { "xmppAccount", "[]xmppSession", "[]xmppChat", "xmppPreferences", "---", "[]xmppRoster", "---", "quit" }; final JMenu menu = gui.createMenu("xmppMenu", xmppMenuActionNames); miRoster = (JCheckBoxMenuItem) menu.getMenuComponent(5); menuBar.add(menu);/*w ww. java 2 s . c om*/ final String[] helpMenuActionNames = { "showAboutBox" }; menuBar.add(gui.createMenu("helpMenu", helpMenuActionNames)); return menuBar; }
From source file:org.kepler.gui.MenuMapper.java
private static void storePTIITopLevelMenus(JMenu nextMenu, String menuPath, final String MENU_PATH_DELIMITER, Map<String, Action> ptiiMenuActionsMap) { int totMenuItems = nextMenu.getMenuComponentCount(); for (int n = 0; n < totMenuItems; n++) { Component nextComponent = nextMenu.getMenuComponent(n); if (nextComponent instanceof JMenuItem) { storePTIIMenuItems((JMenuItem) nextComponent, new StringBuffer(menuPath), MENU_PATH_DELIMITER, ptiiMenuActionsMap); }//from w ww . j a va2s . com // (if it's not an instanceof JMenuItem, it must // be a separator, and can therefore be ignored) } }