Here you can find the source of isEDT()
public static boolean isEDT()
//package com.java2s; // the terms of the GNU General Public License as published by the Free Software Foundation; import javax.swing.*; public class Main { private static final ThreadLocal<Boolean> EDT_FLAG = new ThreadLocal<Boolean>(); /**/*from w w w. j a v a2 s. c o m*/ * Returns TRUE if current thread is EDT. * * @return TRUE if current thread is EDT. */ public static boolean isEDT() { Boolean bool; synchronized (EDT_FLAG) { bool = EDT_FLAG.get(); if (bool == null) { bool = SwingUtilities.isEventDispatchThread(); EDT_FLAG.set(bool); } } return bool; } }