title: componentResized event for Component in Java, but only execute when mouse released
body: <p>I need to do some calculations when one of my Components (a Canvas) gets resized. Unfortunately the calculations can take a few hundred milliseconds which causes the resize to lag heavily while being done. I'd like to solve that by only doing the calculation when the resizing ended (I guess when the mouse button gets released). How can I achieve that? So far I only have the following:</p>
  
  <pre><code>MyComponent.addComponentListener(new ComponentAdapter() {
      @Override
      public void componentResized(ComponentEvent e) {
          super.componentResized(e);
          // some calculation
      }       
  });
  </code></pre>
  
  <p>Thanks.</p>
  
  <p>PS: I know that for a JFrame the resized event gets fired only after the mouse button is released, but unfortunately I cannot put my Component into a JFrame or having it extend a JFrame.</p>