• Post Reply Bookmark Topic Watch Topic
  • New Topic

JProgressBar and Thread?

 
Max Power
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Im trying to display a JProgressBar while my program is busy.
Im using the



method for that. but somehow this does not work. Here is the code:



however, the above does not work :-( and ideas?

THANKS!!
[ June 29, 2004: Message edited by: Gregg Bolinger ]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you be more specific about "doesn't work"?
 
David Weitzman
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should not do anything that takes a long time in the event-handler thread, which is where your ActionListener code runs. Doing so will prevent the application from processing events and repainting itself. You'll want to start a seperate processing thread like this:



If you want to ensure that the user doesn't use the interface while the processing is underway, you can usually just call setEnabled(false) on all the GUI components or have a modal dialog pop up.
[ June 29, 2004: Message edited by: David Weitzman ]
 
Max Power
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, yeah, now it works.

THANKS :-)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!