Is there a way to set up two or more the event dispatch thread (EDT)? Is there a way to set up two or more the event dispatch thread (EDT)? multithreading multithreading

Is there a way to set up two or more the event dispatch thread (EDT)?


There can only be one Event Dispatch Thread!

But why would you even want to have more than one thread for this? Even for "heavy duty" panels with many components (in the application i am currently working on there must be 1000s of components) one EDT is enough. Remember you should not perform any tasks on the EDT that use a lot of CPU time. Otherwise you will block the EDT for update events and your GUI will become "sluggish" in responding to user input.

Also remember that all GUI components should be created and manipulated only from within the EDT because many components are not thread save. Ignoring this guideline may work for specific tasks but sooner or later you will get strange behavior and/or crashes!


The Swing GUI is single threaded. That single thread being the EDT. If you wanted to introduce a second EDT (and still have the GUI working) you would have to also rewrite a lot of the internal Swing code to account for the added complexity of thread safety.

Adding another EDT would introduce more complexity for an unknown amount of increase (or decrease) in performance.