try {
sm.setValueIsAdjusting(true);
sm.clearSelection();
final int anchor = insertAt;
while (!elements.isEmpty()) {
listModel.insertElementAt(elements.pop(), insertAt);
sm.addSelectionInterval(insertAt, insertAt++);
}
final int lead = insertAt - 1;
if (!sm.isSelectionEmpty()) {
sm.setAnchorSelectionIndex(anchor);