This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one for details.
The moose likes Threads and Synchronization and the fly likes How do I make the event dispatch thread wait for a worker thread to complete Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "How do I make the event dispatch thread wait for a worker thread to complete" Watch "How do I make the event dispatch thread wait for a worker thread to complete" New topic
Author

How do I make the event dispatch thread wait for a worker thread to complete

Harry Harding
Greenhorn

Joined: Mar 18, 2010
Posts: 5
Hi all,
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.

Any suggestions?

Thanks.
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

I am really not very sure about your question but if you are asking how does you make one thread wait for other then wait/notify or locks/conditions are the things you should look at.

If it is specific to swing then you might be better off asking the moderator here to move this thread to the swing forum


apigee, a better way to API!
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3026
    
    4

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...


Steve
 
I agree. Here's the link: http://zeroturnaround.com/jrebel
 
subject: How do I make the event dispatch thread wait for a worker thread to complete
 
Similar Threads
Progress bar
Progress bar in a JSP if the click/process takes time...
change progressBar look and feel
Progress bar hangs out.
How to Show the ProgressBar in the browser when i am doing Complex Operation on server