src/share/classes/sun/awt/SunToolkit.java

Print this page

        

@@ -1068,10 +1068,17 @@
     }
 
     public static EventQueue getSystemEventQueueImplPP(AppContext appContext) {
         EventQueue theEventQueue =
             (EventQueue)appContext.get(AppContext.EVENT_QUEUE_KEY);
+        // Sometimes EventQueue stored in AppContext may be null, (e.g. for the
+        // static fields of an applet after refresh of the webpage). Let's use
+        // the EventQueue from the default AppContext in this case.
+        if (theEventQueue == null) {
+            theEventQueue = (EventQueue)(AppContext.getAppContext()).get(
+                AppContext.EVENT_QUEUE_KEY);
+        }
         return theEventQueue;
     }
 
     /**
      * Give native peers the ability to query the native container