Greetings everyone,
I'm thinking it would be nice to include a progress bar in an application I am developing to give the user an idea of what's going on behind the screen and how much's left to be done... I have never had to use the JProgressBar class, so I developed this application below to aid my understanding of the JProgressBar class without using the StringWorker class Sun's
Java tutorial uses to explain how to use the JProgressBar class (truth is, I'm not sure I understood StringWorker totally) or some other
Thread (how do I tie that Thread to this program? 'Haven't figured that out yet....).
The problem with this program is that when the start button is clicked to start the progress bar, the program blocks until the iteration in the program is completed and a full progress bar is displayed. What beats me is that I attempt to update the progress bar inside the actionPerformed method, which is inside the button listener class. But obviously, the JProgressBar (pb) is set when the only when the increasei method returns, that's why I'm getting this behaviour, right? How can I then get around this, without breaking the rule of allowing the realized component to be updated only inside the event dispaching thread?
Any useful suggestion would be greatly appreciated.
Thanks for reading up to this point.