Java Patterns and Pitfalls     frequal.com
Debugging Swing Event Dispatch Thread Violations

Debugging Swing Event Dispatch Thread Violations

Detection

Through the hard work of Scott Delap and Alexander Potochkin it is now easy to find many Swing threading problems caused by making Swing calls from a thread other than the Event Dispatch Thread (EDT).

These are the three easy steps:

The resulting output on stdout will include stack traces of each call to an EDT-only method from a non-EDT thread.

Fixing

Using SwingUtility.invokeAndWait() but make sure you're not already on the EDT first.
Last modified on December 26, 2007 by AO

Copyright © 2007 Andrew Oliver