File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes JProgressBar and threads? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "JProgressBar and threads?" Watch "JProgressBar and threads?" New topic
Author

JProgressBar and threads?

Kevin Schneider
Greenhorn

Joined: Oct 16, 2003
Posts: 10
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

Joined: Jul 29, 2001
Posts: 64
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
 
I agree. Here's the link: jrebel
 
subject: JProgressBar and threads?
 
Similar Threads
SwingUtilities.invokeLater problem
FTP Client
Help! Problem updating JProgressBar.
Problem with FTPClient??
FTPProtocolException:STOR and FTPProtocolException:LIST??