How to check if your code is running on the Java Event Dispatch Thread
Many times we need to check whether code is running on the Java Event Dispatch thread or not ?
We can use static method of the SwingUtilities class if we are not sure if code is running on the event dispatching thread of not.
Following code shows simple check we can have using static method of SwingUtilities class.
System.err.println("In event dispatching thread");
System.err.println("Not an event dispatching thread");