code: private JPopupMenu getJPopupMenu()
      {
          Container parent = this.getParent();
          while (parent != null)
          {
              if (parent instanceof JPopupMenu)
                  return (JPopupMenu)parent;
              parent = parent.getParent();
          }
          return null;
      }
docs: Get the parent popup menu.
  @return The popup menu.