From b9dea208341a3eadf8078a5e98c06956cd3779fe Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Tue, 18 May 2021 15:32:37 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-52087=20=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E5=85=83=E7=B4=A0=E6=95=B0=E6=8D=AE=E5=88=97=E4=B8=AD=E9=A6=96?= =?UTF-8?q?=E6=AC=A1=E4=BF=AE=E6=94=B9=E5=AD=97=E7=AC=A6=E4=B8=8D=E4=BC=9A?= =?UTF-8?q?=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/icombobox/LazyComboBox.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java index 36b8eb2c1..61df2c9c6 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java @@ -55,15 +55,19 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen @Override public void setSelectedItem(Object anObject) { + initialSelected = anObject; if (loaded) { super.setSelectedItem(anObject); } else { - if (initialSelected == null) { - this.setModel(new DefaultComboBoxModel<>(new Object[]{anObject})); - } + this.setModel(new DefaultComboBoxModel<>(new Object[]{anObject})); super.setSelectedItem(anObject); } + + } + + private void setSelectedItemWithDocumentChange(Object anObject) { initialSelected = anObject; + super.setSelectedItem(anObject); } @Override @@ -185,7 +189,7 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen } filtering = true; String xx = textField.getText(); - LazyComboBox.this.setSelectedItem(xx); + LazyComboBox.this.setSelectedItemWithDocumentChange(xx); this.item = textField.getText(); setPopupVisible(true);