title: JProgressBar not triggering propertyChange on setProgress
body: <p>I've read many different articles about JProgressBar...including the dodgy code found over at Java; <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/progress.html" rel="nofollow" title="here">here.</a></p>
  
  <p>Most indicate you need a SwingWorker to get things happening properly, which makes perfect sense, I understand that much. I am finding that when I call setProgress(value) to update the progressbar, it's not triggering the propertyChange event most of the time. I've checked the value I'm passing to setProgess and it definitely changes every time, so I'm not sure if it's just firing the event too quickly? Please see relevant code below, any help/explanation would be greatly appreciated.</p>
  
  <pre><code>class ProgBar extends SwingWorker
  {
      public ProgBar()
      {
          addPropertyChangeListener(new PropertyChangeListener()
          {
             @Override
             public void propertyChange(PropertyChangeEvent evt)
             {
                 if ("progress".equals(evt.getPropertyName()))
                 {
                     int value = (Integer)evt.getNewValue();
                     System.out.println("propertyChange called with: " + value);
                     loginProg.setValue(value);
                 }
             }
          });
  
          loginProg.setStringPainted(true);
          loginProg.setValue(0);
          setProgress(0);
      }
  
      @Override
      public Void doInBackground() throws InterruptedException
      {
          ...
          int count = 0;
          for (Folder f : folders)
          {
              ... // process 'f'
              setProgress((int)Math.min(((double)count/folders.length)*100.0, 100.0));
          }
          ...
          return null;
      }
  
      @Override
      public void done()
      {
          System.out.println("Done called.");
          setProgress(100);
          loginProg.setValue(100);
      }
  }
  </code></pre>
  
  <p><strong>JProgressBar called with this;</strong>  </p>
  
  <pre><code>private void jButtonActionPerformed(java.awt.event.ActionEvent evt) 
  {                                             
          // Create new thread to run progess bar.
          // Otherwise won't be able to update progress bar.
          ProgBar pb = new ProgBar();
          pb.execute();
      }
  }    
  </code></pre>
  
  <p><strong>EDIT:</strong><br>
  Yeah, so I should have read the Javadocs better;</p>
  
  <p><em>Because PropertyChangeListeners are notified asynchronously on the Event Dispatch Thread multiple invocations to the setProgress method might occur before any PropertyChangeListeners are invoked. For performance purposes all these invocations are coalesced into one invocation with the last invocation argument only.</em>  </p>
  
  <p><em>For example, the following invokations:<br>
   setProgress(1);<br>
   setProgress(2);<br>
   setProgress(3);</em></p>
  
  <p><em>might result in a single PropertyChangeListener notification with the value 3.</em></p>
  
  <p>I.E. my assumption that setProgress was firing too quickly was correct. A ProgressMonitor might be a better solution.                </p>