src/share/classes/javax/swing/TransferHandler.java

Print this page

        

@@ -1266,10 +1266,18 @@
                     if (listeners[i]==DropTargetListener.class) {
                         ((DropTargetListener)listeners[i+1]).dragExit(e);
                     }
                 }
             }
+            if (!isActive()) {
+                // If the Drop target is inactive the dragExit will not be dispatched to the dtListener,
+                // so make sure that we clean up the dtListener anyway.
+                DropTargetListener dtListener = getDropTargetListener();
+                    if (dtListener != null && dtListener instanceof DropHandler) {
+                        ((DropHandler)dtListener).cleanup(false);
+                    }
+            }
         }
 
         public void drop(DropTargetDropEvent e) {
             super.drop(e);
             if (listenerList != null) {

@@ -1556,11 +1564,11 @@
             }
 
             handleDrag(e);
         }
 
-        private void cleanup(boolean forDrop) {
+        void cleanup(boolean forDrop) {
             setComponentDropLocation(null, forDrop);
             if (component instanceof JComponent) {
                 ((JComponent)component).dndDone();
             }