• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Harry Harding
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic