Results 1 to 3 of 3
  1. #1
    elin is offline Member
    Join Date
    Jul 2010
    Rep Power

    Default SwingWorker or just plain thread


    I'm trying to write an application which reads streaming information from a socket and displays it in graphical form. I'm using a Java Swing application. Should I put the code for reading information from the socket in a Swingworker thread or just a plain thread. By plain thread I mean something like:

    private static class MessageLoop implements Runnable {


  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power


    I think a SwingWorker would use the same type of Thread as you'd create.
    The reason to use it would be ease of use or to use with other classes.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    Agrees with Norm and also will add that if you decide to go with the non-SwingWorker background thread, take care to call all Swing-related code on the EDT (Event Dispatch Thread) by placing it in a Runnable and call in the parameter of a SwingUtilities.invokeLater(....) call. Much luck!

Similar Threads

  1. plain text printing with java
    By berkeleybross in forum Advanced Java
    Replies: 3
    Last Post: 04-04-2011, 01:01 AM
  2. Replies: 3
    Last Post: 06-08-2010, 08:10 PM
  3. Swingworker or new thread
    By cotarelo in forum Threads and Synchronization
    Replies: 3
    Last Post: 03-24-2010, 06:59 PM
  4. Font.PLAIN - won't set font style to PLAIN!
    By Unsub in forum New To Java
    Replies: 3
    Last Post: 03-11-2010, 12:13 PM
  5. Indentation - plain text
    By barney75 in forum New To Java
    Replies: 1
    Last Post: 03-23-2009, 05:54 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