Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

status dialog with cancel button  RSS feed

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

My program has a big loop which may take 5 or 10 minutes. I need a status dialog with a cancel button, so that user can know status and can cancel anytime. It works just like a download dialog.
How can I implement it? Thanks a lot!
-ZZ
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
zhining,
You will have to run your process in a separate thread. Then just make a call to JOptionPane.showOptionDialog() to show your cancel dialog while the process runs. When your process terminates, if the dialog is still visible, kill it.
Please look at JavaRanch's official naming policy and make sure that you are in compliance with it. Thanks,
Bodie
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks,Bodie!
-Zhining
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, Bodie,
Could you please give me some code, or recommend some resources( like sites or books) to me? Thanks!
-Zhining
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!