Here you can find the source of checkForEventDispatchThread()
Parameter | Description |
---|---|
IllegalStateException | when the current thread is not Swing EDT |
public static void checkForEventDispatchThread() throws IllegalStateException
//package com.java2s; //License from project: Apache License import com.google.common.base.Preconditions; import javax.swing.*; public class Main { /**/* ww w . ja v a2 s. c o m*/ * Checks whether the current thread is Swing EDT. If not - throws an Exception with an advice * * @throws IllegalStateException when the current thread is not Swing EDT */ public static void checkForEventDispatchThread() throws IllegalStateException { Preconditions.checkState(SwingUtilities.isEventDispatchThread(), "The method that caused this trace must be called in the Event Dispatch Thread, see http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html"); } }