0

My program takes exactly 2 minutes to complete it's execution(i know it sounds crazy:P).I want to use jprogressbar to show progress in execution.Is there any simple code that will show progress in jprogressbar for exactly 2 minutes only? or in other words is there any timer like module in java that will run the jprogressbar for 2minutes only? I am using Eclipse IDE. Please help i am new to java.

  • 1
    The purpose of a progress bar is to show the actual advancement of a task, not to stop at a given time. What if your task takes 30 s or 5 mn on a different computer ? – Arnaud May 02 '17 at 13:57
  • @Berger you are right , progress bar is used to show actual advancement of task but i just wanted to know is there any other way of doing it like timer module or something else?for eg set timer to 20secs and start progressbar and it will stop at 20th second,is something like that possible in java? – Mikhil Desai May 02 '17 at 14:02
  • You need to divide your program into steps, set the JProgressBar’s maximum to the step count, and use EventQueue.invokeLater to update the JProgressBar’s value as each step completes. – VGR May 02 '17 at 14:35
  • [For example](http://stackoverflow.com/questions/12020949/jprogressbar-isnt-progressing/12021971#12021971) and yes, before you ask, that's about as simple as it gets – MadProgrammer May 02 '17 at 22:29

0 Answers0