void (final T element) { final ListModel listModel = myList.getModel(); if (listModel instanceof SortedListModel) { ((SortedListModel<T>)listModel).add(element); } else { ((DefaultListModel)listModel).addElement(element); } myList.clearSelection(); ScrollingUtil.selectItem(myList, element); }