popupLocationX = point.x; popupLocationY = point.y;
popupLocationX += point.x; popupLocationY += point.y;
  public void setVisible(final boolean visible)  {    // Hook up this call so that it gets executed on the event thread in order    // to avoid synchronization problems when calling the layout manager.    if (! SwingUtilities.isEventDispatchThread())      {        SwingUtilities.invokeLater(new Runnable()          {            public void run()            {              setVisible(visible);            }          });      }    if (visible == isVisible())      return;    boolean old = isVisible();// @classpath-bugfix 6/9/2006 Martin Husted Hartvig (hagar@jnode.org) :    if (old != visible)      {        if (visible)          {            if (invoker != null)            {              if (!(invoker instanceof JMenu))                {                  MenuElement[] menuEls;                  if (getSubElements().length > 0)                    {                      menuEls = new MenuElement[2];                      menuEls[0] = this;                      menuEls[1] = getSubElements()[0];                  }                  else                    {                      menuEls = new MenuElement[1];                      menuEls[0] = this;                    }                  MenuSelectionManager.defaultManager().setSelectedPath(menuEls);                }              else              {                Point point = ((JMenu)invoker).getPopupMenuOrigin();                popupLocationX = point.x;                popupLocationY = point.y;              }            }            firePopupMenuWillBecomeVisible();            PopupFactory pf = PopupFactory.getSharedInstance();            pack();            popup = pf.getPopup(invoker, this, popupLocationX, popupLocationY);            popup.show();          }        else          {            getSelectionModel().clearSelection();            firePopupMenuWillBecomeInvisible();            popup.hide();          }        this.visible = visible;// @classpath-bugfix-end        firePropertyChange("visible", old, isVisible());      }  }