File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Indeterminate JProgressBar While Running Long Task Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
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: 4523
    
    5

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
Saving a file
JProgressbar problem
JFileChooser Dialog
JProgressBar - Please Help
Set an Normal Inner class variable without creating an instance of the class