title: Setting Scroll Bar on a JScrollPane
body: <p>I have this <code>JTextPane</code> (wrapped in a <code>JScrollPane</code>) that is backed by a <code>HTMLEditorKit</code>. The contents of the <code>JTextPane</code> is simple HTML with some images (local files) embedded using img tags. The problem is that when you load the the <code>JTextPane</code>, it takes a split second to load and then it comes up with the scroll bar at the bottom of the page. If I do:</p>
  
  <pre><code>JTextPane text = new JTextPane();
  JScrollPane scroll = new JScrollPane(text);
  // do some set up...
  scroll.getVerticalScrollBar().setValue(0);
  </code></pre>
  
  <p>it sets the scroll bar momentarily and then another thead (presumably that is in charge of loading the images) comes and knocks the scroll bar back to the bottom. I tried adding:</p>
  
  <pre><code>((AbstractDocument)text.getDocument()).setAsynchronousLoadPriority(-1);
  </code></pre>
  
  <p>but that did not fix it. Is there any way to get an event from either <code>text.getDocument()</code> or <code>text</code> that will notify me when the pane is finished loading so that I can set the scroll bar then? The alternative is that I set up another thread to wait a second or so, and then set the scroll bar, but this is a bad hack.</p>
  
  <p>Your suggestions?</p>