Event dispatching thread: Difference between revisions

Content deleted Content added
Stolsvik (talk | contribs)
m External links: Link to a blogpost/article by me - IMHO rather relevant for this WP article.
Line 8:
from the EDT.
 
The method <code>invokeAndWait()</code> should never be called from the event dispatching thread&mdash;it will throw an [[Exception handling|exception]]. The method {{Javadoc:SE|javax/swing|SwingUtilities|isEventDispatchThread()}} or {{Javadoc:SE|java/awt|EventQueue|isEventDispatchThreadisDispatchThread()}} can be called to determine if the current thread is the event dispatching thread.
 
Another solution for executing code in the EDT is using the ''[[SwingWorker|worker design pattern]]''. The <code>[[SwingWorker]]</code> class, developed by [[Sun Microsystems]], is an implementation of the worker design pattern, and as of Java 6 is part of standard Swing distribution. The open source project [http://foxtrot.sourceforge.net/ Foxtrot] provides another synchronous execution solution similar to <code>SwingWorker</code>.