Indeterminate JProgressBar While Running Long Task
Maas F. Turner
posted 3 years ago
Hi, I'm new to Java and would like to show a dummy JProgressBar in Indeterminate mode while running a long process. The long process would run in the current thread and the ProgressBar in a new thread.
Could someone please help with some sample code for how to do this?
Maas F. Turner wrote:The long process would run in the current thread and the ProgressBar in a new thread.
If this refers to Swing, you have that back to front. The JProgressBar needs to be addressed and queried on the EDT. A long running task needs to be launched in a background Thread, optiamlly handled by a SwingWorker.
Check out the tutorial linked from the JProgressBar API and another section of the same tutorial titled Concurrency in Swing.
And welcome to the Ranch!
There are no new questions, but there may be new answers.