📄 ekit.java
字号:
* selection. * @see #getActions */ /*public*/ static final String selectionPageDownAction = "selection-page-down"; /** * Name of the action to page left horizontally, and move the * selection. * @see #getActions */ /*public*/ static final String selectionPageLeftAction = "selection-page-left"; /** * Name of the action to page right horizontally, and move the * selection. * @see #getActions */ /*public*/ static final String selectionPageRightAction = "selection-page-right"; /** * Name of the Action for moving the caret * logically forward one position. * @see #getActions */ public static final String forwardAction = "caret-forward"; /** * Name of the Action for moving the caret * logically backward one position. * @see #getActions */ public static final String backwardAction = "caret-backward"; /** * Name of the Action for extending the selection * by moving the caret logically forward one position. * @see #getActions */ public static final String selectionForwardAction = "selection-forward"; /** * Name of the Action for extending the selection * by moving the caret logically backward one position. * @see #getActions */ public static final String selectionBackwardAction = "selection-backward"; /** * Name of the Action for moving the caret * logically upward one position. * @see #getActions */ public static final String upAction = "caret-up"; /** * Name of the Action for moving the caret * logically downward one position. * @see #getActions */ public static final String downAction = "caret-down"; /** * Name of the Action for moving the caret * logically upward one position, extending the selection. * @see #getActions */ public static final String selectionUpAction = "selection-up"; /** * Name of the Action for moving the caret * logically downward one position, extending the selection. * @see #getActions */ public static final String selectionDownAction = "selection-down"; /** * Name of the Action for moving the caret * to the begining of a word. * @see #getActions */ public static final String beginWordAction = "caret-begin-word"; /** * Name of the Action for moving the caret * to the end of a word. * @see #getActions */ public static final String endWordAction = "caret-end-word"; /** * Name of the Action for moving the caret * to the begining of a word, extending the selection. * @see #getActions */ public static final String selectionBeginWordAction = "selection-begin-word"; /** * Name of the Action for moving the caret * to the end of a word, extending the selection. * @see #getActions */ public static final String selectionEndWordAction = "selection-end-word"; /** * Name of the Action for moving the caret to the begining of the * previous word. * @see #getActions */ public static final String previousWordAction = "caret-previous-word"; /** * Name of the Action for moving the caret to the begining of the * next word. * to the next of the document. * @see #getActions */ public static final String nextWordAction = "caret-next-word"; /** * Name of the Action for moving the selection to the begining of the * previous word, extending the selection. * @see #getActions */ public static final String selectionPreviousWordAction = "selection-previous-word"; /** * Name of the Action for moving the selection to the begining of the * next word, extending the selection. * @see #getActions */ public static final String selectionNextWordAction = "selection-next-word"; /** * Name of the Action for moving the caret * to the begining of a line. * @see #getActions */ public static final String beginLineAction = "caret-begin-line"; /** * Name of the Action for moving the caret * to the end of a line. * @see #getActions */ public static final String endLineAction = "caret-end-line"; /** * Name of the Action for moving the caret * to the begining of a line, extending the selection. * @see #getActions */ public static final String selectionBeginLineAction = "selection-begin-line"; /** * Name of the Action for moving the caret * to the end of a line, extending the selection. * @see #getActions */ public static final String selectionEndLineAction = "selection-end-line"; /** * Name of the Action for moving the caret * to the begining of a paragraph. * @see #getActions */ public static final String beginParagraphAction = "caret-begin-paragraph"; /** * Name of the Action for moving the caret * to the end of a paragraph. * @see #getActions */ public static final String endParagraphAction = "caret-end-paragraph"; /** * Name of the Action for moving the caret * to the begining of a paragraph, extending the selection. * @see #getActions */ public static final String selectionBeginParagraphAction = "selection-begin-paragraph"; /** * Name of the Action for moving the caret * to the end of a paragraph, extending the selection. * @see #getActions */ public static final String selectionEndParagraphAction = "selection-end-paragraph"; /** * Name of the Action for moving the caret * to the begining of the document. * @see #getActions */ public static final String beginAction = "caret-begin"; /** * Name of the Action for moving the caret * to the end of the document. * @see #getActions */ public static final String endAction = "caret-end"; /** * Name of the Action for moving the caret * to the begining of the document. * @see #getActions */ public static final String selectionBeginAction = "selection-begin"; /** * Name of the Action for moving the caret * to the end of the document. * @see #getActions */ public static final String selectionEndAction = "selection-end"; /** * Name of the Action for selecting a word around the caret. * @see #getActions */ public static final String selectWordAction = "select-word"; /** * Name of the Action for selecting a line around the caret. * @see #getActions */ public static final String selectLineAction = "select-line"; /** * Name of the Action for selecting a paragraph around the caret. * @see #getActions */ public static final String selectParagraphAction = "select-paragraph"; /** * Name of the Action for selecting the entire document * @see #getActions */ public static final String selectAllAction = "select-all"; /** * Name of the Action for removing selection * @see #getActions */ /*public*/ static final String unselectAction = "unselect"; /** * Name of the Action for toggling the component's orientation. * @see #getActions */ /*public*/ static final String toggleComponentOrientationAction = "toggle-componentOrientation"; /** * Name of the action that is executed by default if * a <em>key typed event</em> is received and there * is no keymap entry. * @see #getActions */ public static final String defaultKeyTypedAction = "default-typed"; // --- Action implementations --------------------------------- private static Action[] myActions = { new InsertContentAction(), new DeletePrevCharAction(), new DeleteNextCharAction(), new ReadOnlyAction(), new WritableAction(), new CutAction(), new CopyAction(), new PasteAction(), new PageUpAction(pageUpAction, false), new PageDownAction(pageDownAction, false), new PageUpAction(selectionPageUpAction, true), new PageDownAction(selectionPageDownAction, true), new PageAction(selectionPageLeftAction, true, true), new PageAction(selectionPageRightAction, false, true), new InsertBreakAction(), new BeepAction(), new NextVisualPositionAction(forwardAction, false, SwingConstants.EAST), new NextVisualPositionAction(backwardAction, false, SwingConstants.WEST), new NextVisualPositionAction(selectionForwardAction, true, SwingConstants.EAST), new NextVisualPositionAction(selectionBackwardAction, true, SwingConstants.WEST), new NextVisualPositionAction(upAction, false, SwingConstants.NORTH), new NextVisualPositionAction(downAction, false, SwingConstants.SOUTH), new NextVisualPositionAction(selectionUpAction, true, SwingConstants.NORTH), new NextVisualPositionAction(selectionDownAction, true, SwingConstants.SOUTH), new BeginWordAction(beginWordAction, false), new EndWordAction(endWordAction, false), new BeginWordAction(selectionBeginWordAction, true), new EndWordAction(selectionEndWordAction, true), new PreviousWordAction(previousWordAction, false), new NextWordAction(nextWordAction, false), new PreviousWordAction(selectionPreviousWordAction, true), new NextWordAction(selectionNextWordAction, true), new BeginLineAction(beginLineAction, false), new EndLineAction(endLineAction, false), new BeginLineAction(selectionBeginLineAction, true), new EndLineAction(selectionEndLineAction, true), new BeginParagraphAction(beginParagraphAction, false), new EndParagraphAction(endParagraphAction, false), new BeginParagraphAction(selectionBeginParagraphAction, true), new EndParagraphAction(selectionEndParagraphAction, true), new BeginAction(beginAction, false), new EndAction(endAction, false), new BeginAction(selectionBeginAction, true), new EndAction(selectionEndAction, true), new DefaultKeyTypedAction(), new InsertTabAction(), new SelectWordAction(), new SelectLineAction(), new SelectParagraphAction(), new SelectAllAction(), new UnselectAction(), new ToggleComponentOrientationAction(), new DumpModelAction() }; /** * The action that is executed by default if * a <em>key typed event</em> is received and there * is no keymap entry. There is a variation across * different VM's in what gets sent as a <em>key typed</em> * event, and this action tries to filter out the undesired * events. This filters the control characters and those * with the ALT modifier. It allows Control-Alt sequences * through as these form legitimate unicode characters on * some PC keyboards. * <p> * If the event doesn't get filtered, it will try to insert * content into the text editor. The content is fetched * from the command string of the ActionEvent. The text * entry is done through the <code>replaceSelection</code> * method on the target text component. This is the * action that will be fired for most text entry tasks. * <p> * <strong>Warning:</strong> * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is appropriate * for short term storage or RMI between applications running the same * version of Swing. A future release of Swing will provide support for * long term persistence. * * @see DefaultEditorKit#defaultKeyTypedAction * @see DefaultEditorKit#getActions * @see Keymap#setDefaultAction * @see Keymap#getDefaultAction */ public static class DefaultKeyTypedAction extends TextAction { /** * Creates this object with the appropriate identifier. */ public DefaultKeyTypedAction() { super(defaultKeyTypedAction); } /** * The operation to perform when this action is triggered. * * @param e the action event */ public void actionPerformed(ActionEvent e) { JTextComponent target = getTextComponent(e); if ((target != null) && (e != null)) { if ((! target.isEditable()) || (! target.isEnabled())) { return; } String content = e.getActionCommand(); int mod = e.getModifiers(); if ((content != null) && (content.length() > 0) && ((mod & ActionEvent.ALT_MASK) == (mod & ActionEvent.CTRL_MASK))) { char c = content.charAt(0); if ((c >= 0x20) && (c != 0x7F)) { target.replaceSelection(content); } } } } } /** * Places content into the associated document. * If there is a selection, it is removed before * the new content is added. * <p> * <strong>Warning:</strong> * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is appropriate * for short term storage or RMI between applications running the same * version of Swing. A future release of Swing will provide support for * long term persistence. * * @see DefaultEditorKit#insertContentAction * @see DefaultEditorKit#getActions */ public static class InsertContentAction extends TextAction { /** * Creates this object with the appropriate identifier. */ public InsertContentAction() {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -