forked from fanruan/finekit
richie
5 years ago
1 changed files with 43 additions and 0 deletions
@ -0,0 +1,43 @@
|
||||
package com.fanruan.api.design.ui.component; |
||||
|
||||
import javax.swing.*; |
||||
import java.util.List; |
||||
import java.util.Vector; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2019-08-28 |
||||
* 下拉框 |
||||
*/ |
||||
public class UIComboBox<T> extends com.fr.design.gui.icombobox.UIComboBox { |
||||
|
||||
public UIComboBox() { |
||||
super(); |
||||
} |
||||
|
||||
public UIComboBox(ComboBoxModel<T> model) { |
||||
super(model); |
||||
} |
||||
|
||||
public UIComboBox(T[] items) { |
||||
super(items); |
||||
} |
||||
|
||||
public UIComboBox(Vector<T> items) { |
||||
super(items); |
||||
} |
||||
|
||||
/** |
||||
* 重新设置下拉选项 |
||||
* @param list 下拉选项的集合 |
||||
*/ |
||||
public void refreshSelectableItems(List<T> list) { |
||||
T el = (T) getSelectedItem(); |
||||
removeAllItems(); |
||||
for (T t : list) { |
||||
addItem(t); |
||||
} |
||||
getModel().setSelectedItem(el); |
||||
} |
||||
} |
Loading…
Reference in new issue