• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Usage between SwingWorker and Thread classes

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
We are developing a network management desktop application using Java Swing. Obviously, the network operations are done as separate threads. I doubt whether we can use the ordinary Thread class for implementing the threads, or to use SwingWorker thread.

My Questions are:
B]When to use SwingWorker class and Thread class? What is the purpose of SwingWorker when we have Thread class?[/B]

Thanks and Regards,
Karthik Kannan.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As this article states:

SwingWorker does all the dirty work of implementing a background thread.

One would use SwingWorker in the same circumstances one would use Thread, it's just an easier way to go about it.
BTW, read the above article CAREFULLY. It covers a great deal about Swing and threading. You can avoid a lot of headaches by getting a little knowledge beforehand.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic