How do I make the event dispatch thread wait for a worker thread to complete
posted 6 years ago
Hopefully this is the right forum for this question.
I have a Swing application that has several longer running IO ops it needs to do. I've thrown those ops into their own threads since I want to show a wait cursor and a progress bar to the user. I don't, however want the application to do any more work until the IO op is complete. I need the GUI to stay alive and responsive to update the progress bar.
Agreed, this question is more about disabling swing components, rather than making a Thread wait. Because you want a responsive GUI you actually do not want to make the dispatch thread wait. You really just want to disable user interaction. There are probably a number of ways to do that (such as calling the setEnabled(false) method on the components you want to block, or maybe removing/replacing action listeners or something) but I don't know the best/recommended way...
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads