diff --git a/designer-base/src/main/java/com/fr/design/gui/ipasswordfield/UIPassWordField.java b/designer-base/src/main/java/com/fr/design/gui/ipasswordfield/UIPassWordField.java index 0aad7ee918..5e595643c0 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ipasswordfield/UIPassWordField.java +++ b/designer-base/src/main/java/com/fr/design/gui/ipasswordfield/UIPassWordField.java @@ -1,11 +1,12 @@ package com.fr.design.gui.ipasswordfield; +import com.fr.common.inputevent.InputEventBaseOnOS; import com.fr.design.constants.UIConstants; -import javax.swing.*; +import javax.swing.JPasswordField; import javax.swing.text.Document; -import java.awt.*; +import java.awt.Graphics; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -21,26 +22,34 @@ public class UIPassWordField extends JPasswordField { public UIPassWordField() { super(); - addRollOverListener(); + init(); } public UIPassWordField(String text) { super(text); - addRollOverListener(); + init(); } public UIPassWordField(int columns) { super(columns); - addRollOverListener(); + init(); } public UIPassWordField(String text, int columns) { super(text, columns); - addRollOverListener(); + init(); } public UIPassWordField(Document doc, String txt, int columns) { super(doc, txt, columns); + init(); + } + + /** + * 每个构造方法里都需要做的一些操作 + */ + public void init() { + InputEventBaseOnOS.addBasicEditInputMap(this); addRollOverListener(); } @@ -69,4 +78,4 @@ public class UIPassWordField extends JPasswordField { super.paintBorder(g); } } -} \ No newline at end of file +} diff --git a/designer-base/src/main/java/com/fr/design/gui/itextfield/UITextField.java b/designer-base/src/main/java/com/fr/design/gui/itextfield/UITextField.java index 98823bee9b..10edf9fe00 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itextfield/UITextField.java +++ b/designer-base/src/main/java/com/fr/design/gui/itextfield/UITextField.java @@ -9,11 +9,20 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.Constants; import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JTextField; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.text.Document; -import java.awt.*; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; +import java.awt.LayoutManager; +import java.awt.RenderingHints; + /** * @author Jerry @@ -33,31 +42,33 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs public UITextField() { super(); - InputEventBaseOnOS.addBasicEditInputMap(this); - initListener(); + init(); } public UITextField(int columns) { super(columns); - InputEventBaseOnOS.addBasicEditInputMap(this); - initListener(); + init(); } public UITextField(String text, int columns) { super(text, columns); - InputEventBaseOnOS.addBasicEditInputMap(this); - initListener(); + init(); } public UITextField(String text) { super(text); - InputEventBaseOnOS.addBasicEditInputMap(this); - - initListener(); + init(); } public UITextField(Document doc, String text, int columns) { super(doc, text, columns); + init(); + } + + /** + * 每个构造方法里都需要做的一些操作 + */ + public void init() { InputEventBaseOnOS.addBasicEditInputMap(this); initListener(); } @@ -251,4 +262,4 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs this.isBorderPainted = isBorderPainted; } -} \ No newline at end of file +}