File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Problem with JProgressBar ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problem with JProgressBar ??" Watch "Problem with JProgressBar ??" New topic

Problem with JProgressBar ??

Bikash Paul
Ranch Hand

Joined: Dec 04, 2001
Posts: 342

I am uploading files from swing interface to remote server using loop.Inside loop, application is selecting files sequentially one after another based on size and file is uploading to the server.For every file upload, I want to show the progress bar, using JProgressBar class.
I am able to show the progress bar for the first files uploaded, but for the next File uploading I need to reinitialize the ProgressBar again. I am not able to do this.

Please Suggest me what to do.

Thanks and Regards
Yundi Li, Daniel

Joined: Sep 24, 2002
Posts: 26
you need to use thread
your progressbar is myProgressbar;
int max = total_process;
Thread t = new Thread(){
public void run(){
for(int i =0;i<max;i++){
Bikash Paul
Ranch Hand

Joined: Dec 04, 2001
Posts: 342
Hi Daniel,
First of all thanks for ur help but I couldn't understand 'total_process' variable and method
'do_process()'. Can u plz explain it to me.My scenario is my swing application takes the file automatically(which i have done it through loop) from one folder one by one sorting by size where user store all the files they want to upload and i want to show the progress of uploading of all files through JProgressBar. Now my progressbar showing the status of progress of first file only.
[ February 11, 2003: Message edited by: Bikash Paul ]
I agree. Here's the link:
subject: Problem with JProgressBar ??
It's not a secret anymore!