private MenuBuilder(Menu menu) { this.items = menu.getItems(); this.text = menu.getText(); this.action = menu.getOnAction(); menuObj = menu; ctxMenuObj = null; }
/** * Determines which rule is selected in the Games menu. * * <p>Iterates through the menus in the menu bar looking for the Games menu. Once found it * iterates through the menu items under Games looking for radio buttons. For every radio menu * item it finds it checks if it's been selected. If a selected one is found strRuleName is set * and the whole nest is broken out of and strRuleName is returned. * * @return */ public String getRuleName() { String strRuleName = null; for (Menu m : mb.getMenus()) { if (m.getText() == "Games") { for (MenuItem mi : m.getItems()) { if (mi.getClass().equals(RadioMenuItem.class)) { RadioMenuItem rmi = (RadioMenuItem) mi; if (rmi.isSelected() == true) { strRuleName = rmi.getText(); break; } } } } } return strRuleName; }