src/share/classes/java/awt/Component.java

Print this page

        

@@ -1669,10 +1669,19 @@
 
     void clearCurrentFocusCycleRootOnHide() {
         /* do nothing */
     }
 
+    /*
+     * Delete references from LightweithDispatcher of a heavyweight parent
+     */
+    void clearLightweightDispatcherOnRemove(Component removedComponent) {
+        if (parent != null) {
+            parent.clearLightweightDispatcherOnRemove(removedComponent);
+        }
+    }
+
     /**
      * @deprecated As of JDK version 1.1,
      * replaced by <code>setVisible(boolean)</code>.
      */
     @Deprecated

@@ -6972,10 +6981,12 @@
             KeyboardFocusManager.getCurrentKeyboardFocusManager().
                 setGlobalPermanentFocusOwner(null);
         }
 
         synchronized (getTreeLock()) {
+            clearLightweightDispatcherOnRemove(this);
+            
             if (isFocusOwner() && KeyboardFocusManager.isAutoFocusTransferEnabledFor(this)) {
                 transferFocus(true);
             }
 
             if (getContainer() != null && isAddNotifyComplete) {