1 /*
   2  * @test
   3  * @bug 7122796
   4  * @summary Tests 7122796
   5  * @author anthony.petrov@oracle.com
   6  */
   7 
   8 import java.awt.*;
   9 import java.awt.event.*;
  10 import javax.swing.*;
  11 import sun.awt.*;
  12 
  13 public class MainAppContext {
  14 
  15     public static void main(String[] args) {
  16         ThreadGroup secondGroup = new ThreadGroup("test");
  17         new Thread(secondGroup, new Runnable() {
  18                 public void run() {
  19                     SunToolkit.createNewAppContext();
  20                     test(true);
  21                 }
  22             }).start();
  23 
  24         // Sleep on the main thread so that the AWT Toolkit is initialized
  25         // in a user AppContext first
  26         try { Thread.sleep(2000); } catch (Exception e) {}
  27 
  28         test(false);
  29     }
  30 
  31     private static void test(boolean userAppContext) {
  32         if (Toolkit.getDefaultToolkit().getSystemEventQueue() == null) {
  33             throw new RuntimeException("No EventQueue for the current app context! userAppContext: " + userAppContext);
  34         }
  35     }
  36 }