diff --git a/designer_base/src/com/fr/design/gui/icombobox/LazyComboBox.java b/designer_base/src/com/fr/design/gui/icombobox/LazyComboBox.java index 5ff9330295..2d69c2fc83 100644 --- a/designer_base/src/com/fr/design/gui/icombobox/LazyComboBox.java +++ b/designer_base/src/com/fr/design/gui/icombobox/LazyComboBox.java @@ -175,8 +175,10 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen this.item = item; this.setting = true; + textField.setSetting(true); String newText = (item == null) ? "" : item.toString(); textField.setText(newText); + textField.setSetting(false); this.setting = false; } diff --git a/designer_base/src/com/fr/design/gui/itextfield/UITextField.java b/designer_base/src/com/fr/design/gui/itextfield/UITextField.java index 7df91335c2..76dad8e30a 100644 --- a/designer_base/src/com/fr/design/gui/itextfield/UITextField.java +++ b/designer_base/src/com/fr/design/gui/itextfield/UITextField.java @@ -25,6 +25,8 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs private String textFeildName = ""; private GlobalNameListener globalNameListener = null; private Dimension preferredSize = null; + //有些情况下setText的时候不希望触发attributeChange,添加一个属性标识 + private boolean isSetting = false; public UITextField() { super(); @@ -79,6 +81,7 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs } + public void setPreferredSize(Dimension preferredSize) { this.preferredSize = preferredSize; } @@ -88,6 +91,9 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs } protected void attributeChange() { + if(isSetting){ + return; + } if (globalNameListener != null && shouldResponseNameListener()) { globalNameListener.setGlobalName(textFeildName); }