• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

How to put ProgressMonitor bar while saving a file

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know how to set progress monitor bar while bar while reading a file.
The code may be like

But i dont know how to do it while i am saving a file
Can u help me out please
 
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
I've used the JProgressBar. you'll have to know the size of your file and increase the progress appropriately (that's what you have already done while reading the file).
chantal
 
aminur rashid
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But suppose if i am running a process which does reading a file and doing some operation like calculating something and then saving the file.
and i want to show the JProgressBar once i have started the process.In that case i dont know how much time the operation will take and i think this can't be done by knowing simply the size of file

Originally posted by Chantal Ackermann:
hi,
I've used the JProgressBar. you'll have to know the size of your file and increase the progress appropriately (that's what you have already done while reading the file).
chantal


 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can decide when to increment the progress bar. for example: you give the whole operation the value 1000 and then you decide how much every part of the process will cost. say, reading the file 700, calculating 200 and saving 100. while you read you may have a while-loop where you can increment in small steps until you reach the 700. however, at the end of the operation 1000 should be reached and that are the 100% of the progress bar. (remember, 1000 was just an example. it's your decision what value you set for the 100%)
chantal
 
I promise I will be the best, most loyal friend ever! All for this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic