protected void processMouseMotionEvent(MouseEvent e) { MouseEvent transformedEvent = transformMouseEvent(e); if (mouseEnteredComponent == null) { mouseEnteredComponent = mouseCurrentComponent; } switch (e.getID()) { case MouseEvent.MOUSE_MOVED: if (mouseCurrentComponent != mouseEnteredComponent) { dispatchMouseEvent( createEnterExitEvent(mouseEnteredComponent, MouseEvent.MOUSE_EXITED, e)); dispatchMouseEvent( createEnterExitEvent(mouseCurrentComponent, MouseEvent.MOUSE_ENTERED, e)); } break; case MouseEvent.MOUSE_DRAGGED: if (mouseDraggedComponent == null) { mouseDraggedComponent = mouseEnteredComponent; } if (mouseEnteredComponent == mouseDraggedComponent && mouseCurrentComponent != mouseDraggedComponent) { dispatchMouseEvent( createEnterExitEvent(mouseDraggedComponent, MouseEvent.MOUSE_EXITED, e)); } else if (mouseEnteredComponent != mouseDraggedComponent && mouseCurrentComponent == mouseDraggedComponent) { dispatchMouseEvent( createEnterExitEvent(mouseDraggedComponent, MouseEvent.MOUSE_ENTERED, e)); } if (mouseDraggedComponent != null) { transformedEvent.setSource(mouseDraggedComponent); } break; } mouseEnteredComponent = mouseCurrentComponent; // dispatch MouseMotionEvent MouseMotionListener[] mouseMotionListeners = transformedEvent.getComponent().getMouseMotionListeners(); for (MouseMotionListener listener : mouseMotionListeners) { // skip all ToolTipManager's related listeners if (!listener.getClass().getName().startsWith("javax.swing.ToolTipManager")) { switch (transformedEvent.getID()) { case MouseEvent.MOUSE_MOVED: listener.mouseMoved(transformedEvent); break; case MouseEvent.MOUSE_DRAGGED: listener.mouseDragged(transformedEvent); break; default: throw new AssertionError(); } } } super.processMouseMotionEvent(e); }