Java tutorial
//package com.java2s; public class Main { public final static void checkIsEventDispatchThreadElseException() { if (!java.awt.EventQueue.isDispatchThread()) { throw new RuntimeException("Not on AWT EventDispatchThread"); } } }