📄 editorkeyboardhandler.java
字号:
/** * $Id: EditorKeyboardHandler.java,v 1.1 2009/02/22 11:01:18 gaudenz Exp $ * Copyright (c) 2008, Gaudenz Alder */package com.mxgraph.swing.examples.editor;import javax.swing.ActionMap;import javax.swing.InputMap;import javax.swing.JComponent;import javax.swing.KeyStroke;import com.mxgraph.swing.mxGraphComponent;import com.mxgraph.swing.handler.mxKeyboardHandler;import com.mxgraph.swing.util.mxGraphActions;/** * @author Administrator * */public class EditorKeyboardHandler extends mxKeyboardHandler{ /** * * @param graphComponent */ public EditorKeyboardHandler(mxGraphComponent graphComponent) { super(graphComponent); } /** * Return JTree's input map. */ protected InputMap getInputMap(int condition) { InputMap map = super.getInputMap(condition); if (condition == JComponent.WHEN_FOCUSED && map != null) { map.put(KeyStroke.getKeyStroke("control S"), "save"); map.put(KeyStroke.getKeyStroke("control shift S"), "saveAs"); map.put(KeyStroke.getKeyStroke("control N"), "new"); map.put(KeyStroke.getKeyStroke("control O"), "open"); map.put(KeyStroke.getKeyStroke("control Z"), "undo"); map.put(KeyStroke.getKeyStroke("control Y"), "redo"); map .put(KeyStroke.getKeyStroke("control shift V"), "selectVertices"); map.put(KeyStroke.getKeyStroke("control shift E"), "selectEdges"); } return map; } /** * Return the mapping between JTree's input map and JGraph's actions. */ protected ActionMap createActionMap() { ActionMap map = super.createActionMap(); map.put("save", new EditorActions.SaveAction(false)); map.put("saveAs", new EditorActions.SaveAction(true)); map.put("new", new EditorActions.NewAction()); map.put("open", new EditorActions.OpenAction()); map.put("undo", new EditorActions.HistoryAction(true)); map.put("redo", new EditorActions.HistoryAction(false)); map.put("selectVertices", mxGraphActions.getSelectVerticesAction()); map.put("selectEdges", mxGraphActions.getSelectEdgesAction()); return map; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -