SwingUtilities.invokeLater(new Runnable() { public void run() { bugDescriptionScrollPane.getViewport().setViewPosition(new Point(0, 0)); } }); }
String html = I18N.instance().getDetailHTML(bugDetailsKey); bugDescriptionEditorPane.setContentType("text/html"); bugDescriptionEditorPane.setText(html); currentBugDetailsKey = bugDetailsKey;        SwingUtilities.invokeLater(new Runnable() { public void run() { bugDescriptionScrollPane.getViewport().setViewPosition(new Point(0, 0)); } }); }
    private void showBugInfo(BugInstance bugInstance) {	// Are we already showing details for this kind of bug?	String bugDetailsKey = bugInstance.getType();	if (bugDetailsKey.equals(currentBugDetailsKey))	    return;        	// Display the details	String html = I18N.instance().getDetailHTML(bugDetailsKey);	bugDescriptionEditorPane.setContentType("text/html");	bugDescriptionEditorPane.setText(html);	currentBugDetailsKey = bugDetailsKey;	// FIXME: unfortunately, using setText() on the editor pane	// results in the contents being scrolled to the bottom of the pane.	// An immediate inline call to set the scroll position does nothing.	// So, use invokeLater(), even though this results in flashing.	// [What we really need is a way to set the text WITHOUT changing	// the caret position.  Need to investigate.]	SwingUtilities.invokeLater(new Runnable() {	    public void run() {		bugDescriptionScrollPane.getViewport().setViewPosition(new Point(0, 0));	    }	});    }