Here you can find the source of assertEventDispatcherThread()
public static void assertEventDispatcherThread()
//package com.java2s; //License from project: Open Source License import javax.swing.*; public class Main { /**//ww w .ja va2 s .c om * Assert we are in the event dispatching thread. */ public static void assertEventDispatcherThread() { if (!SwingUtilities.isEventDispatchThread()) throw new IllegalStateException("Not an AWT thread."); } }