title: Swing update puzzle
body: <p>I have a Jtree with nodes representing images that the user can call up and view.   Sometimes it takes the images up to four or five seconds to load.    Ideally, I would like wait cursor to show while the user is waiting and the node selected in the tree to be selected.   However, what I'm find is that the user clicks on the node, nothing appears to happen and then the image appears and then the node is selected (the wait cursor never appears or more likely appears very briefly and then disappears immediately.   I've tried repainting both the tree and the applet to try to force the behavior to happen in the sequence I want.   So far, I've not had any luck.   Any suggestions?
  Here is a section of some Swing code that is giving me problems:</p>
  
  <pre><code> thisApplet.setCursor(new Cursor(Cursor.WAIT_CURSOR));
   selectdocumentTreeLeaf(); // a JTree with nodes representing images                  
   tree.repaint();
   thisApplet.repaint();
   tree.setEnabled(false); //disabled so users don't keep clicking on it.   
   result = createImage(queue.q[pointer].currentPage); //where the image is fetched              
   thisApplet.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
  </code></pre>
  
  <hr>