lastComponentEntered.dispatchEvent(exited);
tempComponent = lastComponentEntered; lastComponentEntered = null; tempComponent.dispatchEvent(exited);
    public void acquireComponentForMouseEvent(MouseEvent me)    {      int x = me.getX();      int y = me.getY();      // Find the candidate which should receive this event.      Component parent = layeredPane;      Component candidate = null;      Point p = me.getPoint();      while ((candidate == null) && (parent != null))        {	  p = SwingUtilities.convertPoint(glassPane, p.x, p.y, parent);	  candidate = SwingUtilities.getDeepestComponentAt(parent, p.x, p.y);	  if (candidate == null)	    {	      p = SwingUtilities.convertPoint(parent, p.x, p.y,	                                      parent.getParent());	      parent = parent.getParent();	    }        }      // If the only candidate we found was the native container itself,      // don't dispatch any event at all.  We only care about the lightweight      // children here.      if (candidate == layeredPane)	candidate = null;      // If our candidate is new, inform the old target we're leaving.      if ((lastComponentEntered != null) && lastComponentEntered.isShowing()          && (lastComponentEntered != candidate))        {	  // Old candidate could have been removed from 	  // the layeredPane so we check first.	  if (SwingUtilities.isDescendingFrom(lastComponentEntered, layeredPane))	    {	      Point tp = SwingUtilities.convertPoint(layeredPane, x, y,	                                             lastComponentEntered);	      MouseEvent exited = new MouseEvent(lastComponentEntered,	                                         MouseEvent.MOUSE_EXITED,	                                         me.getWhen(),	                                         me.getModifiersEx(), tp.x,	                                         tp.y, me.getClickCount(),	                                         me.isPopupTrigger(),	                                         me.getButton());	      lastComponentEntered.dispatchEvent(exited);	    }	  lastComponentEntered = null;        }      // If we have a candidate, maybe enter it.      if (candidate != null)        {	  mouseEventTarget = candidate;	  if (candidate.isLightweight() && candidate.isShowing()	      && (candidate != layeredPane)	      && (candidate != lastComponentEntered))	    {	      lastComponentEntered = mouseEventTarget;	      Point cp = SwingUtilities.convertPoint(layeredPane, x, y,	                                             lastComponentEntered);	      MouseEvent entered = new MouseEvent(lastComponentEntered,	                                          MouseEvent.MOUSE_ENTERED,	                                          me.getWhen(),	                                          me.getModifiersEx(), cp.x,	                                          cp.y, me.getClickCount(),	                                          me.isPopupTrigger(),	                                          me.getButton());	      lastComponentEntered.dispatchEvent(entered);	    }        }      if ((me.getID() == MouseEvent.MOUSE_RELEASED)          || ((me.getID() == MouseEvent.MOUSE_PRESSED) && (pressCount > 0))          || (me.getID() == MouseEvent.MOUSE_DRAGGED))        {	  // If any of the following events occur while a button is held down,	  // they should be dispatched to the same component to which the	  // original MOUSE_PRESSED event was dispatched:	  //   - MOUSE_RELEASED	  //   - MOUSE_PRESSED: another button pressed while the first is held down	  //   - MOUSE_DRAGGED	  if (SwingUtilities.isDescendingFrom(pressedComponent, layeredPane))	    mouseEventTarget = pressedComponent;	  else if (me.getID() == MouseEvent.MOUSE_CLICKED)	    {	      // Don't dispatch CLICKED events whose target is not the same as the	      // target for the original PRESSED event.	      if (candidate != pressedComponent)		mouseEventTarget = null;	      else if (pressCount == 0)		pressedComponent = null;	    }        }    }