I have been trying to understand how to add a progress bar, I can create one within the GUI I am implementing and get it to appear but even after checking through http://doc
See my answer on another SO question which includes an example of a JProgressBar
which gets updated by using a SwingWorker
. The SwingWorker
is used to execute a long running task in the background (in case of the example it is just a regular Thread.sleep
) and report on progress at certain intervals.
I would also strongly suggest to take a look at the Swing concurrency tutorial for more background info on why you should use a SwingWorker
when performing long-running tasks which interfere with the UI.
A similar example as the one I posted is available in the Swing tutorial about JProgressBars, which it also worth looking at