Results 1 to 4 of 4
  1. #1
    cotarelo is offline Member
    Join Date
    Mar 2010
    Posts
    43
    Rep Power
    0

    Post Swingworker or new thread

    Short question.

    when is the case we should use a different thread in a gui instead of a swingworker instance.

    Or say in a different way, what is the cases the swingworker is meant to be used.

  2. #2
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    SwingWorker is a standardized class that allows you to do work on a separate thread and report the results back to Swing components using the EDT. The advantage is that a lot of plumbing is available to handle various activities. The disadvantage is that it can be unnecessarily complicated, *if* you know how to set up a thread and to invoke updates on the EDT.

    Look at the SwingWorker API to understand all things it provides. If you know how to code those sorts of things yourself, then it may make more sense to write your own thread. Otherwise, the SwingWorker will do things right.

  3. #3
    cotarelo is offline Member
    Join Date
    Mar 2010
    Posts
    43
    Rep Power
    0

    Default

    thanks, i spent many time trying to work this swingworker out, now I solved it launching a thread, it was much more simpler.

    What do you mean by plumbing?

  4. #4
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    "Plumbing" is a figure of speech. Among U.S. programmers, it means the actual implementation of standard features. Sorry, I forgot that most people using this site wouldn't know what that meant.

    What I meant is, that SwingWorker provides a bunch of standard methods to return results to Swing components on the EDT, so you can focus on the business logic.
    The Java Tutorial. Read it.

Similar Threads

  1. SwingWorker question
    By cotarelo in forum Threads and Synchronization
    Replies: 16
    Last Post: 03-23-2010, 11:29 AM
  2. SwingWorker Problem
    By Berkan in forum Threads and Synchronization
    Replies: 10
    Last Post: 03-11-2010, 03:28 AM
  3. SwingWorker Opinions
    By frejon26 in forum AWT / Swing
    Replies: 3
    Last Post: 04-13-2009, 08:41 PM
  4. Replies: 3
    Last Post: 10-02-2008, 05:48 AM
  5. swingworker
    By musiigedeo in forum AWT / Swing
    Replies: 1
    Last Post: 07-26-2007, 12:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •