if (target != null)
if (target != null && (dragTarget == null || dragTarget == target))
  private boolean handleMouseEvent(MouseEvent ev)  {    Window window = (Window) ev.getSource();    Component target = window.findComponentAt(ev.getX(), ev.getY());    target = findTarget(target);    if (target == null || target.isLightweight())      {        // Dispatch additional MOUSE_EXITED and MOUSE_ENTERED if event target        // is different from the last event target.        if (target != lastTarget)          {            if (lastTarget != null)              {                Point p1 = AWTUtilities.convertPoint(window, ev.getX(),                                                     ev.getY(), lastTarget);                MouseEvent mouseExited =                  new MouseEvent(lastTarget, MouseEvent.MOUSE_EXITED,                                 ev.getWhen(), ev.getModifiers(), p1.x, p1.y,                                 ev.getClickCount(), ev.isPopupTrigger());                lastTarget.dispatchEvent(mouseExited);              }            if (target != null)              {            Point p = AWTUtilities.convertPoint(window, ev.getX(), ev.getY(),                                                target);            MouseEvent mouseEntered =              new MouseEvent(target, MouseEvent.MOUSE_ENTERED, ev.getWhen(),                             ev.getModifiers(), p.x, p.y, ev.getClickCount(),                             ev.isPopupTrigger());            target.dispatchEvent(mouseEntered);          }          }                switch (ev.getID())        {          case MouseEvent.MOUSE_PRESSED:            dragTarget = target;            break;          case MouseEvent.MOUSE_RELEASED:            if (dragTarget != null)              target = dragTarget;            dragTarget = null;            break;          case MouseEvent.MOUSE_CLICKED:            // When we receive a MOUSE_CLICKED, we set the target to the            // previous target, which must have been a MOUSE_RELEASED event.            // This is necessary for the case when the MOUSE_RELEASED has            // caused the original target (like an internal component) go            // away.            target = lastTarget;            break;          case MouseEvent.MOUSE_DRAGGED:            target = dragTarget;            break;          default:            // Do nothing in other cases.            break;        }        lastTarget = target;        if (target != null)          {        Point targetCoordinates =          AWTUtilities.convertPoint(window, ev.getX(), ev.getY(), target);        int dx = targetCoordinates.x - ev.getX();        int dy = targetCoordinates.y - ev.getY();        ev.translatePoint(dx, dy);        ev.setSource(target);        target.dispatchEvent(ev);        // We reset the event, so that the normal event dispatching is not        // influenced by this modified event.        ev.setSource(window);        ev.translatePoint(-dx, -dy);          }	return true;      }    else      return false;  }