• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can visit this link
java.sun.com/products/jfc/tsc/articles/threads/threads2.html
silva.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic