• Post Reply Bookmark Topic Watch Topic
  • New Topic

JProgressBar and threads?  RSS feed

 
Kevin Schneider
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am writing a simple file transfer app and i'd like to add a progress bar. however, the problem i'm having is that the bar doesnt update until the transfer is finished.
here is what my methods look like:

and here is where i call these methods during the transfer:

[ October 23, 2003: Message edited by: Kevin Schneider ]
 
kyle amburn
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi-
Try the following code:

I am not sure why you threaded the setting of the maximum value, unless it changes often. You may also want to add some code to pause your file transfer momentarily every few milliseconds to ensure that the thread updating the progress bar has a chance to execute.
Hope this helps.
Kyle
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!