📄 editorpopupmenu.java
字号:
package com.mxgraph.swing.examples.editor;import javax.swing.JMenu;import javax.swing.JPopupMenu;import javax.swing.TransferHandler;import com.mxgraph.swing.examples.editor.EditorActions.HistoryAction;import com.mxgraph.swing.util.mxGraphActions;import com.mxgraph.util.mxResources;public class EditorPopupMenu extends JPopupMenu{ public EditorPopupMenu(BasicGraphEditor editor) { boolean selected = !editor.getGraphComponent().getGraph() .isSelectionEmpty(); add(editor.bind(mxResources.get("undo"), new HistoryAction(true), "/com/mxgraph/swing/examples/images/undo.gif")); addSeparator(); add( editor.bind(mxResources.get("cut"), TransferHandler .getCutAction(), "/com/mxgraph/swing/examples/images/cut.gif")) .setEnabled(selected); add( editor.bind(mxResources.get("copy"), TransferHandler .getCopyAction(), "/com/mxgraph/swing/examples/images/copy.gif")) .setEnabled(selected); add(editor.bind(mxResources.get("paste"), TransferHandler .getPasteAction(), "/com/mxgraph/swing/examples/images/paste.gif")); addSeparator(); add( editor.bind(mxResources.get("delete"), mxGraphActions .getDeleteAction(), "/com/mxgraph/swing/examples/images/delete.gif")) .setEnabled(selected); addSeparator(); // Creates the format menu JMenu menu = (JMenu) add(new JMenu(mxResources.get("format"))); EditorMenuBar.populateFormatMenu(menu, editor); // Creates the shape menu menu = (JMenu) add(new JMenu(mxResources.get("shape"))); EditorMenuBar.populateShapeMenu(menu, editor); addSeparator(); add( editor.bind(mxResources.get("edit"), mxGraphActions .getEditAction())).setEnabled(selected); addSeparator(); add(editor.bind(mxResources.get("selectVertices"), mxGraphActions .getSelectVerticesAction())); add(editor.bind(mxResources.get("selectEdges"), mxGraphActions .getSelectEdgesAction())); addSeparator(); add(editor.bind(mxResources.get("selectAll"), mxGraphActions .getSelectAllAction())); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -