示例#1
0
 /**
  * Returns the popup menu which is at the root of the menu system for this popup menu.
  *
  * @return the topmost grandparent <code>JPopupMenu</code>
  */
 JPopupMenu getRootPopupMenu() {
   JPopupMenu mp = this;
   while ((mp != null)
       && (mp.isPopupMenu() != true)
       && (mp.getInvoker() != null)
       && (mp.getInvoker().getParent() != null)
       && (mp.getInvoker().getParent() instanceof JPopupMenu)) {
     mp = (JPopupMenu) mp.getInvoker().getParent();
   }
   return mp;
 }