Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Making JOptionPane disappear after Ok is pressed

 
Barry Brashear
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a situation where I'm opening a JOptionPane with a warning message
and then some processing occur after the ok button is clicked. What's happening is the JOptionPane appears frozen with OK button pressed until
after the processing completes. How can I make sure the JOptionPane disappears afte the ok button is pressed?

Thanks.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're probably doing this processing right in an event handler, which ties up the event-handing thread and blocks any screen updates until the processing is over. Any time you do any nontrivial computation in a GUI app, you should create a new Thread and do the computation in that Thread, freeing up the event thread to do things like make JOptionPanes disappear.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic