title: Repaint JPanel only after window resize is finished
body: <p>I have a JPanel on which I've painted four rectangles.  The color for each of these rectangles is selected at random.  The colors should change only when the user clicks on a particular rectangle.</p>
  
  <p>The problem is, while a user is resizing the window, everything on the JPanel is 'repainted' repeatedly.  This causes the rectangles to rapidly change color.</p>
  
  <p>Ideally, I would need the colors of the rectangles to stay the same during a resize.  Otherwise, I could also manage with a solution where the JPanel is repainted only once after a resize has been completed.</p>
  
  <p>Do you have any general ideas on how I could implement this?  I feel like it would have been a lot easier if there was a onStartResize and onFinishResize callback method in ComponentListener.</p>
  
  <p>Thanks!</p>