title: Make GUI more responsive
body: <p>The program I have visualizes a physics simulation (basically).  Right now, it works, but can get very unresponsive, and I think I know why - too much (read:all) computation is done on the event thread. </p>
  
  <p>When the 'play' button is pressed, a Swing <code>Timer</code> is created that wakes up periodically and calls <code>updateTime()</code> - so far so good. The problem is that <code>updateTime()</code> iterates through every time-dependent object and tells it to propagate itself forwards in time by the appropriate amount (either the real time elapsed, or an arbitrary time unit each tick). These calculations, and the subsequent GUI updates, are all on the event dispatch thread.</p>
  
  <p>So, I'd like to offload as much of this computation as possible, and I think <code>SwingWorker</code>s are the way to go, but I'm not sure how to work them into the existing code. I can't have the existing classes extend <code>SwingWorker</code> since many of them already extend other classes. </p>
  
  <p>My best idea so far is to create an interface for each time-dependent object to implement. The interface would specify 2 methods, <code>calcUpdateTime()</code> and <code>drawUpdateTime()</code>. I would split up each of their current <code>updateTime()</code> methods into the physics calculations (into <code>calc_</code>) and GUI updates (into <code>draw_</code>). Then I would create only one class of SwingWorker that takes a <code>TimeDependant</code> object in the constructor, and its <code>doInBackground</code> would call <code>calcUpdateTime</code> and <code>done</code> would call <code>drawUpdateTime</code>. So then I can replace all occurrences of </p>
  
  <pre><code>myObj.updateTime(currentTime);
  </code></pre>
  
  <p>with</p>
  
  <pre><code>new MySwingWorker(myObj, currentTime).execute();
  </code></pre>
  
  <p>I wanted to run this idea by SO because it doesn't feel quite right, and it would like to avoid refactoring the entire project just to find out I started out with a bad idea. Also, isn't it probably a bad idea to create potentially dozens of <code>MySwingWorker</code>s each tick?</p>
  
  <p>Thanks for reading this far.</p>