}
);
// This is a trick to reorder the thumbnail tasks
// so refreshes happen in order in the viewport.
getVerticalScrollBar().addAdjustmentListener(
new AdjustmentListener() {
public void adjustmentValueChanged(AdjustmentEvent e) {
if (! e.getValueIsAdjusting()) {
EventQueue.invokeLater(
new Runnable() {
public void run() {
// May be run after dispose().
if (browser != null)
browser.repaint();
}
}
);
}
}
}
);
// When scrolling ceases, bump the scroll position so that browser
// features align with the viewport:
getVerticalScrollBar().addAdjustmentListener(
new AdjustmentListener() {
boolean isSnapping;
public void adjustmentValueChanged(AdjustmentEvent e) {
if ((! e.getValueIsAdjusting()) && (browser != null)) {
// Don't recurse.
if (! isSnapping) {