DnDEventImpl (Component aComponentOverDragging, Point aPoint, int nativeAction, DataFlavor @Nullable [] flavors, @Nullable Transferable transferable) { LOG.debug("updateCurrentEvent: ", aComponentOverDragging); DnDEventImpl currentEvent = myCurrentEvent; if (myCurrentEvent == null && aComponentOverDragging instanceof JComponent jComp) { DnDTarget target = getTarget(jComp); if (target instanceof DnDNativeTarget) { DnDEventImpl event = (DnDEventImpl)jComp.getClientProperty(DnDNativeTarget.EVENT_KEY); if (event == null) { DnDNativeTarget.EventInfo info = new DnDNativeTarget.EventInfo(flavors, transferable); event = new DnDEventImpl(this, DnDAction.COPY, info, aPoint); jComp.putClientProperty(DnDNativeTarget.EVENT_KEY, event); } currentEvent = event; } } if (currentEvent == null) return null; final DnDAction dndAction = getDnDActionForPlatformAction(nativeAction); if (dndAction == null) return null; currentEvent.updateAction(dndAction); currentEvent.setPoint(aPoint); currentEvent.setHandlerComponent(aComponentOverDragging); boolean samePoint = currentEvent.getPoint().equals(myLastProcessedPoint); Component component = myLastProcessedOverComponent != null ? myLastProcessedOverComponent.get() : null; boolean sameComponent = currentEvent.getCurrentOverComponent().equals(component); boolean sameAction = nativeAction == myLastProcessedAction; LOG.debug("updateCurrentEvent: point:", aPoint); LOG.debug("updateCurrentEvent: action:", nativeAction); if (samePoint && sameComponent && sameAction && transferable != myCurrentEvent) { return currentEvent; } DnDTarget target = getTarget(aComponentOverDragging); DnDTarget immediateTarget = target; Component eachParent = aComponentOverDragging; final Pair<Image, Point> pair = currentEvent.getUserData(DRAGGED_IMAGE_KEY); if (pair != null) { target.updateDraggedImage(pair.first, aPoint, pair.second); } LOG.debug("updateCurrentEvent: action:" + nativeAction); while (true) { boolean canGoToParent = update(target, currentEvent); if (currentEvent.isDropPossible()) { if (currentEvent.wasDelegated()) { target = currentEvent.getDelegatedTarget(); } break; } if (!canGoToParent) { break; } eachParent = findAllowedParentComponent(eachParent); if (eachParent == null) { break; } target = getTarget(eachParent); } LOG.debug("updateCurrentEvent: target:" + target); LOG.debug("updateCurrentEvent: immediateTarget:" + immediateTarget); if (!currentEvent.isDropPossible() && !immediateTarget.equals(target)) { update(immediateTarget, currentEvent); } updateCursor(); Container current = (Container)currentEvent.getCurrentOverComponent(); Point point = currentEvent.getPointOn(getLayeredPane(current)); Rectangle inPlaceRect = new Rectangle(point.x - 5, point.y - 5, 5, 5); if (!currentEvent.equals(myLastProcessedEvent)) { hideCurrentHighlighter(); } DnDTarget processedTarget = getLastProcessedTarget(); boolean sameTarget = processedTarget != null && processedTarget.equals(target); if (sameTarget) { if (currentEvent.isDropPossible()) { if (!myLastProcessedPoint.equals(currentEvent.getPoint())) { if (!Highlighters.isVisibleExcept(DnDEvent.DropTargetHighlightingType.TEXT | DnDEvent.DropTargetHighlightingType.ERROR_TEXT)) { hideCurrentHighlighter(); queueTooltip(currentEvent, getLayeredPane(current), inPlaceRect); } } } else if (myLastProcessedPoint == null || !myLastProcessedPoint.equals(currentEvent.getPoint())) { hideCurrentHighlighter(); queueTooltip(currentEvent, getLayeredPane(current), inPlaceRect); } } else { hideCurrentHighlighter(); if (processedTarget != null) { processedTarget.cleanUpOnLeave(); } currentEvent.clearDropHandler(); if (!currentEvent.isDropPossible()) { queueTooltip(currentEvent, getLayeredPane(current), inPlaceRect); } } myLastProcessedTarget = new WeakReference<>(target); myLastProcessedPoint = currentEvent.getPoint(); myLastProcessedOverComponent = new WeakReference<>(currentEvent.getCurrentOverComponent()); myLastProcessedAction = currentEvent.getAction().getActionId(); myLastProcessedEvent = (DnDEvent)currentEvent.clone(); return currentEvent; }