Пример #1
0
  @Override
  public boolean isSelected() {

    // return true if any top level menu item is selected

    boolean selected = false;

    if (fileMenu.isSelected() || helpMenu.isSelected() || customerMenu.isSelected()) {
      selected = true;
    }

    return selected;
  } // end of MainMenu::isSelected
 /** Close the currently selected menu. */
 public void closeMenu() {
   if (menuBar.isSelected()) {
     MenuElement[] menuElement = menuBar.getSubElements();
     if (menuElement != null) {
       for (int i = 0; i < menuElement.length; i++) {
         JMenu menu = (JMenu) menuElement[i];
         if (menu.isSelected()) {
           menu.setPopupMenuVisible(false);
           menu.setSelected(false);
           break;
         }
       }
     }
   }
 }