title: update gui with SwingWorker
body: <p>I'm trying to update a <code>progressBar</code> with the value that a class generates and sends to a <code>SwingWorker</code>.</p>
  
  <p>In the GUI I have this method: </p>
  
  <pre><code>@Override
  public void propertyChange(PropertyChangeEvent evt) {
     if (evt.getPropertyName().equals("progress")) {
        int progress = (Integer) evt.getNewValue();
        jProgressBar1.setValue(progress);
     }
  }
  </code></pre>
  
  <p>and I'm doing this also:</p>
  
  <pre><code>private void startWorker(){
       worker = WorkerUpdater.getInstance();    
       worker.addPropertyChangeListener(this);
       worker.execute();
  }
  </code></pre>
  
  <p>In the <code>SwingWorker</code> I have a method <code>"setProgress"</code> to update the value of the variable from the object which calculates it and then I want that the <code>SwinWorker</code> reads this value ant repaint the <code>progressBar</code>. </p>
  
  <p>How can I do that in the <code>doInBackground()</code> method? I have the next method but I want to update the <code>progressBar</code> every time the value of property "progress" change in the <code>SwingWorker</code>. </p>
  
  <p>If I do that way it's working, but I want to update the progressBar only when other class modifies de value "progress" in the SwingWorker's atribute. How can I do it?</p>
  
  <pre><code>@Override
      public Void doInBackground() throws Exception {
          while(this.progress&lt;100){
             setProgress(this.progress+10);
             this.progress += 10;
          }       
          return null;
      }
  </code></pre>