SwingUtilities.convertPointToScreen(sourcePointOnScreen, source);
if (source.isShowing()) SwingUtilities.convertPointToScreen(sourcePointOnScreen, source);
  public Component componentForPoint(Component source, Point sourcePoint)  {    // Convert sourcePoint to screen coordinates.    Point sourcePointOnScreen = sourcePoint;    SwingUtilities.convertPointToScreen(sourcePointOnScreen, source);    Point compPointOnScreen;    Component resultComp = null;    // For each menu element on the selected path, express its location     // in terms of screen coordinates and check if there is any     // menu element on the selected path that contains given source point.    for (int i = 0; i < selectedPath.size(); i++)      {	Component comp = ((Component) selectedPath.get(i));        Dimension size = comp.getSize();	// convert location of this menu item to screen coordinates	compPointOnScreen = comp.getLocationOnScreen();	if (compPointOnScreen.x <= sourcePointOnScreen.x	    && sourcePointOnScreen.x < compPointOnScreen.x + size.width	    && compPointOnScreen.y <= sourcePointOnScreen.y	    && sourcePointOnScreen.y < compPointOnScreen.y + size.height)	  {	    Point p = sourcePointOnScreen;	    SwingUtilities.convertPointFromScreen(p, comp);	    resultComp = SwingUtilities.getDeepestComponentAt(comp, p.x, p.y);	    break;	  }      }    return resultComp;  }