forked from LupusNobilis/java-org.hwo.ui
Fix ComboBoxHistoryModel (Selected Item rearrange bug)
parent
d6f43f3608
commit
53eafa9b4b
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue