hzzz 7 years ago
parent
commit
54c008a3b9
  1. 13
      designer_base/src/com/fr/design/gui/ilist/UIList.java
  2. 13
      designer_base/src/com/fr/design/gui/itextarea/UITextArea.java
  3. 17
      designer_base/src/com/fr/design/gui/itextfield/UITextField.java
  4. 9
      designer_base/src/com/fr/design/gui/itree/checkboxtree/CheckBoxTree.java
  5. 9
      designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java

13
designer_base/src/com/fr/design/gui/ilist/UIList.java

@ -6,10 +6,14 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.text.DefaultEditorKit;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.util.Vector;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/**
* Created with IntelliJ IDEA.
* User: pony
@ -22,6 +26,15 @@ public class UIList extends JList{
public UIList() {
super();
InputMap inputMap = this.getInputMap();
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER),
DefaultEditorKit.selectAllAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER),
DefaultEditorKit.copyAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER),
DefaultEditorKit.pasteAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER),
DefaultEditorKit.cutAction);
}
public UIList(ListModel dataModel) {

13
designer_base/src/com/fr/design/gui/itextarea/UITextArea.java

@ -7,13 +7,26 @@ import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.DefaultEditorKit;
import java.awt.*;
import java.awt.event.KeyEvent;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class UITextArea extends JTextArea implements UIObserver {
private UIObserverListener uiObserverListener;
public UITextArea(int i, int j) {
super(i, j);
InputMap inputMap = this.getInputMap();
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER),
DefaultEditorKit.selectAllAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER),
DefaultEditorKit.copyAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER),
DefaultEditorKit.pasteAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER),
DefaultEditorKit.cutAction);
initComponents();
}

17
designer_base/src/com/fr/design/gui/itextfield/UITextField.java

@ -1,12 +1,12 @@
package com.fr.design.gui.itextfield;
import java.awt.*;
import java.awt.event.KeyEvent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.DefaultEditorKit;
import javax.swing.text.Document;
import com.fr.design.event.GlobalNameListener;
@ -16,6 +16,8 @@ import com.fr.design.event.UIObserverListener;
import com.fr.stable.Constants;
import com.fr.design.utils.gui.GUICoreUtils;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/**
* @author Jerry
*/
@ -30,6 +32,15 @@ public class UITextField extends JTextField implements UIObserver, GlobalNameObs
public UITextField() {
super();
InputMap inputMap = this.getInputMap();
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER),
DefaultEditorKit.selectAllAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER),
DefaultEditorKit.copyAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER),
DefaultEditorKit.pasteAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER),
DefaultEditorKit.cutAction);
initListener();
}

9
designer_base/src/com/fr/design/gui/itree/checkboxtree/CheckBoxTree.java

@ -16,10 +16,10 @@ import java.beans.PropertyChangeListener;
import java.util.Hashtable;
import java.util.Vector;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
import javax.swing.*;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.text.DefaultEditorKit;
import javax.swing.text.Position;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreeCellRenderer;
@ -29,6 +29,8 @@ import javax.swing.tree.TreePath;
import com.fr.design.gui.icheckbox.UICheckBox;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
/**
* CheckBoxTree is a special JTree which uses UICheckBox as the tree renderer.
* In addition to regular JTree's features, it also allows you select any number
@ -87,6 +89,9 @@ public class CheckBoxTree extends JTree {
public CheckBoxTree(TreeModel newModel) {
super(newModel);
InputMap inputMap = this.getInputMap();
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER),
"selectAll");
init();
}

9
designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java

@ -13,10 +13,7 @@ import com.fr.general.LogRecordTime;
import com.fr.stable.xml.LogRecordTimeProvider;
import javax.swing.*;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.*;
import java.awt.*;
import java.awt.event.*;
import java.text.SimpleDateFormat;
@ -192,9 +189,9 @@ public class DesignerLogHandler {
private JTextPane initLogJTextArea() {
JTextPane resultPane = new JTextPane();
InputMap inputMap = resultPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), "copy");
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), DefaultEditorKit.copyAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER), DefaultEditorKit.selectAllAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_L, DEFAULT_MODIFIER), "clear");
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER), "select-all");
ActionMap actionMap = resultPane.getActionMap();
actionMap.put("clear", new AbstractAction() {
public void actionPerformed(ActionEvent evt) {

Loading…
Cancel
Save