// Scroll up or down as necessary to keep selected row
// viewable
if (selectedRow >= 0) {
int spheight = scrollPane.getHeight();
JScrollBar sb = scrollPane.getVerticalScrollBar();
int sv = sb.getValue();
int paneheight = ((LayerPane) panes.get(selectedRow)).getHeight();
int rowvalue = selectedRow * paneheight;
// Don't reset scrollBar unless the selected row
// is not in the viewable range
if (!((rowvalue > sv) && (rowvalue < spheight + sv))) {
sb.setValue(rowvalue);
}
}
Object[] layerArray = layerList.toArray();
int length = layerArray.length;