Browse Source

REPORT-38555 fix:数字控件中内容可以输入空格和减号

Destiny.Lin 2 years ago
parent
commit
8d26f1b058
  1. 17
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java
  2. 1
      designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java
  3. 10
      designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java

17
designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java

@ -22,8 +22,19 @@ import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.plaf.ButtonUI;
import java.awt.*;
import java.awt.event.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver {
@ -61,6 +72,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
init(minValue, maxValue, dierta);
textField.setValue(defaultValue);
}
protected void init(double minValue, double maxValue, double dierta) {
this.minValue = minValue;
this.maxValue = maxValue;
@ -399,6 +411,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
public boolean shouldResponseNameListener() {
return true;
}
/**
* 程序入口 测试
*

1
designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java

@ -4,7 +4,6 @@ import com.fr.base.Utils;
import com.fr.general.ComparatorUtils;
import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils;
import org.gradle.internal.impldep.org.junit.Test;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;

10
designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java

@ -21,16 +21,14 @@ import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by kerry on 2017/9/10.

Loading…
Cancel
Save