src/share/classes/java/awt/Window.java

Print this page

        

@@ -224,10 +224,11 @@
     private transient Component temporaryLostComponent;
 
     static boolean systemSyncLWRequests = false;
     boolean     syncLWRequests = false;
     transient boolean beforeFirstShow = true;
+    private transient boolean disposing = false;
 
     static final int OPENED = 0x01;
 
     /**
      * An Integer value representing the Window State.

@@ -1160,10 +1161,12 @@
     }
 
     void doDispose() {
     class DisposeAction implements Runnable {
         public void run() {
+            disposing = true;
+            try {
             // Check if this window is the fullscreen window for the
             // device. Exit the fullscreen mode prior to disposing
             // of the window if that's the case.
             GraphicsDevice gd = getGraphicsConfiguration().getDevice();
             if (gd.getFullScreenWindow() == Window.this) {

@@ -1190,10 +1193,13 @@
                     inputContext.dispose();
                     inputContext = null;
                 }
             }
             clearCurrentFocusCycleRootOnHide();
+            } finally {
+                disposing = false;
+            }
         }
     }
         DisposeAction action = new DisposeAction();
         if (EventQueue.isDispatchThread()) {
             action.run();

@@ -2732,10 +2738,14 @@
     */
     public boolean isShowing() {
         return visible;
     }
 
+    boolean isDisposing() {
+        return disposing;
+    }
+
     /**
      * @deprecated As of J2SE 1.4, replaced by
      * {@link Component#applyComponentOrientation Component.applyComponentOrientation}.
      */
     @Deprecated