title: java swingworker thread to update main Gui
body: <p>hi id like to know whats the best way to add text to a jtextarea from a swingworkerthread, ive created another class which a jbutton calls by Threadsclass().execute();
  and the thread runs in parallel fine with this code </p>
  
  <pre><code>public class Threadsclass extends SwingWorker&lt;Object, Object&gt; {
  
  
  @Override
  protected Object doInBackground() throws Exception {
      for(int x = 0; x&lt; 10;x++)
          try {
              System.out.println("sleep number :"+ x);
  
  
  
          Thread.sleep(1000);
      } catch (InterruptedException ex) {
          Logger.getLogger(eftcespbillpaymentsThreads.class.getName()).log(Level.SEVERE, null, ex);
      }
      throw new UnsupportedOperationException("Not supported yet.");
  }
  
  }
  </code></pre>
  
  <p>now what id like to do is add the value of x to the text area on the main gui, any ideas much appreciated.</p>