}
    private boolean popupVisible()    {      JMenuBar mb = (JMenuBar) ((JMenu)menuItem).getParent();      // check if mb.isSelected because if no menus are selected      // we don't have to look through the list for popup menus      if (!mb.isSelected())        return false;      for (int i=0;i<mb.getMenuCount();i++)        if (((JMenu)mb.getComponent(i)).isPopupMenuVisible())          return true;      return false;    }