I am implemening one GUI application, i have a general problem;
one window of the applivation performs some operations, it takes 5 min time. During this 5min time; the total application was strucking and i can not any other task in that window.
I appreciate your advices to come out of this problem.
Thank you,
Regards,
Cp Baherwani
Ranch Hand
Joined: May 13, 2005
Posts: 41
posted
0
You need a SwingWorker thread to do the job which takes upto 5 minutes.
Hi, I have a question about the previous answer. Is the swingworker a thread or it there are any differences? In the previous example is the swingworker class more appropriate than a single thread and why? P.S.:I have to admit that I haven't take a look at the swingworker class, I'm just try to identify if I have to do it [ January 13, 2006: Message edited by: hartzoua hartzoua ]
Is the swingworker a thread or it there are any differences?
SwingWorker is simply a convenience wrapper around the Thread class. It frees you from having to implement Runnable/extend Thread, which may be inconvenient when you are dealing with lots of GUI classes. You could use either a thread or SwingWorker to solve a problem like the one above. Which one you use is more a stylistic decision than a technical one. Have a look at the How To Use Threads In Swing page from the Java Tutorial for some examples.