Skip to content

Commit e74c281

Browse files
committed
ComboBoxNultiSelection: fixed error setSelectedItems and clearSelectedItems (issue #3)
1 parent d1e2faf commit e74c281

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

combobox-multiple-selection/src/raven/combobox/ComboBoxMultiSelection.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ public List<Object> getSelectedItems() {
3737
}
3838

3939
public void setSelectedItems(List<Object> selectedItems) {
40+
// clear the internal selection to avoid duplicates
41+
clearSelectedItems();
42+
4043
List<Object> comboItem = new ArrayList<>();
4144
int count = getItemCount();
4245
for (int i = 0; i < count; i++) {
@@ -59,7 +62,9 @@ public void clearSelectedItems() {
5962
panel.removeAll();
6063
revalidate();
6164
repaint();
62-
comboList.repaint();
65+
if (comboList != null) {
66+
comboList.repaint();
67+
}
6368
}
6469
}
6570

0 commit comments

Comments
 (0)