Fix ComboBoxHistoryModel (Selected Item rearrange bug)

master
Harald Wolff 2018-02-22 11:54:10 +01:00
parent d6f43f3608
commit 53eafa9b4b
1 changed files with 5 additions and 3 deletions

View File

@ -9,8 +9,8 @@ import javax.swing.event.ListDataListener;
public class ComboBoxHistoryModel<E> implements ComboBoxModel<E> {
private LinkedList<ListDataListener> listDataListeners = new LinkedList();
private LinkedList<E> items = new LinkedList();
private LinkedList<ListDataListener> listDataListeners = new LinkedList<>();
private LinkedList<E> items = new LinkedList<>();
private E selectedItem;
private int historySize;
@ -68,7 +68,9 @@ public class ComboBoxHistoryModel<E> implements ComboBoxModel<E> {
items.remove(selectedItem);
}
items.add(0,selectedItem);
clampHistory();
if (!clampHistory()) {
fireContentsChanged();
}
}
public int getHistorySize() {