From 3660aba3911adcc043852269d41cd1f673acb1c0 Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Fri, 9 Apr 2021 18:26:30 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-50598=20=E6=95=B0=E5=AD=97=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E6=A1=86=E8=BE=93=E5=85=A5=E6=9C=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/gui/itextfield/UINumberField.java | 43 ------------------- 1 file changed, 43 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java index 62d24c56a..0d1287d8c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java +++ b/designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java @@ -4,16 +4,11 @@ import com.fr.base.Utils; import com.fr.general.ComparatorUtils; import com.fr.stable.CoreConstants; import com.fr.stable.StringUtils; - -import javax.swing.event.CaretEvent; -import javax.swing.event.CaretListener; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.PlainDocument; import java.awt.Dimension; import java.awt.Toolkit; -import java.awt.event.InputMethodEvent; -import java.awt.event.InputMethodListener; /** * Number Field. @@ -39,11 +34,6 @@ public class UINumberField extends UITextField { private boolean isContentChanged = false; private boolean fillNegativeNumber = true; - /** - * 输入法输入完成一个字符输入过程的标记。开始输入的时候是true,输入完矫正光标后为false - */ - private boolean isInputMethodOnceInserting = false; - private int insertOffset = 0; public UINumberField() { this(MAX_INTEGERLENGTH_32, MAX_DECIMALLENGTH); @@ -64,7 +54,6 @@ public class UINumberField extends UITextField { this.minValue = minValue; this.maxValue = maxValue; setFieldDocument(); - initFieldListener(); } public void setFieldDocument() { @@ -72,31 +61,6 @@ public class UINumberField extends UITextField { initListener(); } - private void initFieldListener() { - addInputMethodListener(new InputMethodListener() { - @Override - public void inputMethodTextChanged(InputMethodEvent event) { - isInputMethodOnceInserting = true; - } - - @Override - public void caretPositionChanged(InputMethodEvent event) { - } - }); - - addCaretListener(new CaretListener() { - @Override - public void caretUpdate(CaretEvent e) { - if (isInputMethodOnceInserting) { - isInputMethodOnceInserting = false; - setCaretPosition(insertOffset); - } else { - insertOffset = e.getDot(); - } - } - }); - } - public void canFillNegativeNumber(boolean fillNegativeNumber) { this.fillNegativeNumber = fillNegativeNumber; } @@ -221,13 +185,6 @@ public class UINumberField extends UITextField { super.insertString(offset, s, a); } - public void remove(int offs, int len) throws BadLocationException { - if (isInputMethodOnceInserting) { - return; - } - super.remove(offs, len); - } - // kunsnat: 这种限制输入 有个不好的地方, 比如删除时: 10.1 最大值限定100, 那么就删除中间的小数点之后变为101, 超出了100. // 但是直接限制不能删除中间类似小数点, 那么也可能遇到: 最小值10 , 从100变化到其中的19, 就很难.. private boolean notChange(String strNew) {