I have an executable jar that extracts files from itself. I would like to have a JProgressBar show the progress of this. Below is the code I use for extraction. How can I implement a JProgressBar to use this? I would like to increment it with each "buffered IO dump".
Thanks in advance,
Jason R. Kretzer<br />Software Engineer<br />System Administrator<br /><a href="http://alia.iwarp.com" target="_blank" rel="nofollow">http://alia.iwarp.com</a>
posted 13 years ago
Hi Jason, Probably the best way to do this is to construct a JProgressBar and a Timer (javax.swing.Timer). Then add an ActionListener to the Timer and in the actionPerformed method update the Progress Bar. You'll probably have to experiment with how often the Timer fires to get the granularity you want. As you probably know you shouldn't modify any swing components outside the event thread, so don't be tempted to just update the Progress bar on the fly. One other possibility you may check out is the ProgressMonitor class. Hope this helps Michael Morris SCJP2 [ March 25, 2002: Message edited by: Michael Morris ]
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher