if (rect == null) {
throw new IllegalStateException(
"attempting to access index " + lastIndex + " for " + comboBox);
}
list.scrollRectToVisible(rect);
}
//setting the selected item should scroll it into the visible region
comboBox.setSelectedItem(item);
}