Browse Source

下拉框

master
richie 5 years ago
parent
commit
bee1ab6cab
  1. 43
      src/main/java/com/fanruan/api/design/ui/component/UIComboBox.java

43
src/main/java/com/fanruan/api/design/ui/component/UIComboBox.java

@ -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…
Cancel
Save