From bee1ab6cabe9899f1f733abd76a39895c0a7e2da Mon Sep 17 00:00:00 2001 From: richie Date: Wed, 28 Aug 2019 21:18:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/design/ui/component/UIComboBox.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/main/java/com/fanruan/api/design/ui/component/UIComboBox.java diff --git a/src/main/java/com/fanruan/api/design/ui/component/UIComboBox.java b/src/main/java/com/fanruan/api/design/ui/component/UIComboBox.java new file mode 100644 index 0000000..1a53d68 --- /dev/null +++ b/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 extends com.fr.design.gui.icombobox.UIComboBox { + + public UIComboBox() { + super(); + } + + public UIComboBox(ComboBoxModel model) { + super(model); + } + + public UIComboBox(T[] items) { + super(items); + } + + public UIComboBox(Vector items) { + super(items); + } + + /** + * 重新设置下拉选项 + * @param list 下拉选项的集合 + */ + public void refreshSelectableItems(List list) { + T el = (T) getSelectedItem(); + removeAllItems(); + for (T t : list) { + addItem(t); + } + getModel().setSelectedItem(el); + } +}