|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.fr.design.gui.itextfield; |
|
|
|
package com.fr.design.gui.itextfield; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.common.inputevent.InputEventBaseOnOS; |
|
|
|
import com.fr.design.event.GlobalNameListener; |
|
|
|
import com.fr.design.event.GlobalNameListener; |
|
|
|
import com.fr.design.event.GlobalNameObserver; |
|
|
|
import com.fr.design.event.GlobalNameObserver; |
|
|
|
import com.fr.design.event.UIObserver; |
|
|
|
import com.fr.design.event.UIObserver; |
|
|
@ -10,12 +11,8 @@ import com.fr.stable.Constants; |
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.event.DocumentEvent; |
|
|
|
import javax.swing.event.DocumentEvent; |
|
|
|
import javax.swing.event.DocumentListener; |
|
|
|
import javax.swing.event.DocumentListener; |
|
|
|
import javax.swing.text.DefaultEditorKit; |
|
|
|
|
|
|
|
import javax.swing.text.Document; |
|
|
|
import javax.swing.text.Document; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.event.KeyEvent; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author Jerry |
|
|
|
* @author Jerry |
|
|
@ -31,42 +28,32 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs |
|
|
|
|
|
|
|
|
|
|
|
public UITextField() { |
|
|
|
public UITextField() { |
|
|
|
super(); |
|
|
|
super(); |
|
|
|
InputMap inputMap = this.getInputMap(); |
|
|
|
InputEventBaseOnOS.addBasicEditInputMap(this); |
|
|
|
while (inputMap.getParent() != null) { |
|
|
|
|
|
|
|
inputMap = inputMap.getParent(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER)) == null) { |
|
|
|
|
|
|
|
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER), DefaultEditorKit.selectAllAction); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER)) == null) { |
|
|
|
|
|
|
|
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), DefaultEditorKit.copyAction); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER)) == null) { |
|
|
|
|
|
|
|
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER), DefaultEditorKit.pasteAction); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (inputMap.get(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER)) == null) { |
|
|
|
|
|
|
|
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER), DefaultEditorKit.cutAction); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
initListener(); |
|
|
|
initListener(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public UITextField(int columns) { |
|
|
|
public UITextField(int columns) { |
|
|
|
super(columns); |
|
|
|
super(columns); |
|
|
|
|
|
|
|
InputEventBaseOnOS.addBasicEditInputMap(this); |
|
|
|
initListener(); |
|
|
|
initListener(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public UITextField(String text, int columns) { |
|
|
|
public UITextField(String text, int columns) { |
|
|
|
super(text, columns); |
|
|
|
super(text, columns); |
|
|
|
|
|
|
|
InputEventBaseOnOS.addBasicEditInputMap(this); |
|
|
|
initListener(); |
|
|
|
initListener(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public UITextField(String text) { |
|
|
|
public UITextField(String text) { |
|
|
|
super(text); |
|
|
|
super(text); |
|
|
|
|
|
|
|
InputEventBaseOnOS.addBasicEditInputMap(this); |
|
|
|
|
|
|
|
|
|
|
|
initListener(); |
|
|
|
initListener(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public UITextField(Document doc, String text, int columns) { |
|
|
|
public UITextField(Document doc, String text, int columns) { |
|
|
|
super(doc, text, columns); |
|
|
|
super(doc, text, columns); |
|
|
|
|
|
|
|
InputEventBaseOnOS.addBasicEditInputMap(this); |
|
|
|
initListener(); |
|
|
|
initListener(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|