• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to put ProgressMonitor bar while saving a file

 
aminur rashid
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • 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
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!