title: How does Swing handle consecutive changes to the same component?
body: <p>I'm a little confused about the Swing painting model.</p>
  
  <p>Suppose that I have a JComponent comp, and I do something like:</p>
  
  <pre><code>c.setBackground(Color.RED);
  c.setBackground(Color.YELLOW);
  </code></pre>
  
  <p>Obviously, the end result is that the color is yellow.</p>
  
  <p>How does Swing handle this?</p>
  
  <p>Does the first call trigger an immediate repaint so there'll be a short flicker of red before the yellow? Is this sequence significantly slower than just a paint of yellow?</p>
  
  <p>If I was running this from outside the Swing Event thread, I would assume that in most cases (though a race condition is possible), by the time the Swing EDT comes visiting the property is already set to yellow so there'll never be any red painted.</p>
  
  <p>However, my understanding is that I should make these calls from inside a Runnable in the Swing EDT. Is that correct? In that case it would seem like the EDT would have to fully perform each change without any "lookahead"?</p>