• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with JProgressBar ??

 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
He's my best friend. Not yours. Mine. You can have this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic