< prev index next >

src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java

Print this page

        

@@ -853,18 +853,18 @@
      * Called from Toolkit native code when a WM_DISPLAYCHANGE occurs.
      * Have Win32GraphicsEnvironment execute the display change code on the
      * Event thread.
      */
     public static void displayChanged() {
-        EventQueue.invokeLater(new Runnable() {
-            @Override
-            public void run() {
-                ((Win32GraphicsEnvironment)GraphicsEnvironment
-                .getLocalGraphicsEnvironment())
-                .displayChanged();
+        Runnable runnable = () ->
+                ((Win32GraphicsEnvironment) GraphicsEnvironment
+                        .getLocalGraphicsEnvironment()).displayChanged();
+        if (AppContext.getAppContext() == null) {
+            new Thread(null, runnable, "displayChanged", 0, false).start();
+        } else {
+            EventQueue.invokeLater(runnable);
             }
-        });
     }
 
     /**
      * create the peer for a DragSourceContext
      */
< prev index next >