The moose likes Swing / AWT / SWT and the fly likes Indeterminate JProgressBar While Running Long Task Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Indeterminate JProgressBar While Running Long Task" Watch "Indeterminate JProgressBar While Running Long Task" New topic
Author

Indeterminate JProgressBar While Running Long Task

Maas F. Turner
Greenhorn

Joined: Jun 04, 2012
Posts: 1
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?

Thanks.

Example of what I need to do:
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4167
    
    3

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!


luck, db
There are no new questions, but there may be new answers.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Indeterminate JProgressBar While Running Long Task
 
Similar Threads
Set an Normal Inner class variable without creating an instance of the class
JProgressBar - Please Help
JProgressbar problem
JFileChooser Dialog
Saving a file