Java tutorial
//package com.java2s; import javax.swing.SwingUtilities; public class Main { public static void assertInEventDispatchThread() { if (!SwingUtilities.isEventDispatchThread()) { throw new IllegalStateException("Must be called from event dispatch thread"); } } }