Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with JProgressBar ??

 
Bikash Paul
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

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
Bikash
 
Yundi Li, Daniel
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you need to use thread
e.g
your progressbar is myProgressbar;
int max = total_process;
myProgressbar.setMaximum(max);
Thread t = new Thread(){
public void run(){
for(int i =0;i<max;i++){
do_process(i);
myProgressbar.setValue(i);
}
}
};
 
Bikash Paul
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Regards
Bikash
[ February 11, 2003: Message edited by: Bikash Paul ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic