wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes I want to monitor a task activated by a button. Do I have to use Threads? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "I want to monitor a task activated by a button. Do I have to use Threads?" Watch "I want to monitor a task activated by a button. Do I have to use Threads?" New topic
Author

I want to monitor a task activated by a button. Do I have to use Threads?

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Lately I have had one similar problem on several occasions. I have button in a JFrame, with an ActionListener connected to the button. When I press this button a task will begin. Then I want to monitor this task, with a ProgressBar that pops up for example. The problem is that the button will be pressed down during the computation of the task and the progress bar will not be updated. To make this work, do I have to execute a new thread which deals with the task and updating of the progress bar?
I hope you understand my problem and have a suitable solution for it.
selvas kumars
Ranch Hand

Joined: Jan 06, 2001
Posts: 115
You can find out a swingworker class in java site, which
does similar work for updating the task.Here a seperate thread is
there to update the UserInterface.
silva.
selvas kumars
Ranch Hand

Joined: Jan 06, 2001
Posts: 115
you can visit this link
java.sun.com/products/jfc/tsc/articles/threads/threads2.html
silva.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
"jockern",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in again with a new name which meets the requirements.
Thanks.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I want to monitor a task activated by a button. Do I have to use Threads?
 
Similar Threads
progress bar in swing
Java swing background execution
Progress bar within dialog box
Progress Bar
ProgressMonitor and threading ...