📄 editormenubar.java
字号:
menu.addSeparator(); submenu = (JMenu) menu.add(new JMenu(mxResources.get("layout"))); submenu.add(editor.graphLayout("verticalHierarchical")); submenu.add(editor.graphLayout("horizontalHierarchical")); submenu.addSeparator(); submenu.add(editor.graphLayout("verticalPartition")); submenu.add(editor.graphLayout("horizontalPartition")); submenu.addSeparator(); submenu.add(editor.graphLayout("verticalStack")); submenu.add(editor.graphLayout("horizontalStack")); submenu.addSeparator(); submenu.add(editor.graphLayout("verticalTree")); submenu.add(editor.graphLayout("horizontalTree")); submenu.addSeparator(); submenu.add(editor.graphLayout("placeEdgeLabels")); submenu.add(editor.graphLayout("parallelEdges")); submenu.addSeparator(); submenu.add(editor.graphLayout("organicLayout")); submenu.add(editor.graphLayout("circleLayout")); submenu = (JMenu) menu.add(new JMenu(mxResources.get("selection"))); submenu.add(editor.bind(mxResources.get("selectPath"), new SelectShortestPathAction(false))); submenu.add(editor.bind(mxResources.get("selectDirectedPath"), new SelectShortestPathAction(true))); submenu.addSeparator(); submenu.add(editor.bind(mxResources.get("selectTree"), new SelectSpanningTreeAction(false))); submenu.add(editor.bind(mxResources.get("selectDirectedTree"), new SelectSpanningTreeAction(true))); menu.addSeparator(); submenu = (JMenu) menu.add(new JMenu(mxResources.get("stylesheet"))); submenu .add(editor .bind( mxResources.get("basicStyle"), new StylesheetAction( "/com/mxgraph/swing/examples/resources/basic-style.xml"))); submenu .add(editor .bind( mxResources.get("defaultStyle"), new StylesheetAction( "/com/mxgraph/swing/examples/resources/default-style.xml"))); // Creates the options menu menu = add(new JMenu(mxResources.get("options"))); submenu = (JMenu) menu.add(new JMenu(mxResources.get("display"))); submenu.add(new TogglePropertyItem(graphComponent, mxResources .get("buffering"), "TripleBuffered", true)); submenu.add(new TogglePropertyItem(graphComponent, mxResources .get("preferPageSize"), "PreferPageSize", true, new ActionListener() { /** * */ public void actionPerformed(ActionEvent e) { graphComponent.zoomAndCenter(); } })); // TODO: This feature is not yet implemented //submenu.add(new TogglePropertyItem(graphComponent, mxResources // .get("pageBreaks"), "PageBreakVisible", true)); submenu.addSeparator(); submenu.add(editor.bind(mxResources.get("tolerance"), new PromptPropertyAction(graph, "Tolerance"))); submenu.add(editor.bind(mxResources.get("dirty"), new ToggleDirtyAction())); submenu = (JMenu) menu.add(new JMenu(mxResources.get("zoom"))); submenu.add(new TogglePropertyItem(graphComponent, mxResources .get("centerZoom"), "CenterZoom", true)); submenu.add(new TogglePropertyItem(graphComponent, mxResources .get("zoomToSelection"), "KeepSelectionVisibleOnZoom", true)); submenu.addSeparator(); submenu.add(new TogglePropertyItem(graphComponent, mxResources .get("centerPage"), "CenterPage", true, new ActionListener() { /** * */ public void actionPerformed(ActionEvent e) { if (graphComponent.isPageVisible() && graphComponent.isCenterPage()) { graphComponent.zoomAndCenter(); } } })); menu.addSeparator(); submenu = (JMenu) menu.add(new JMenu(mxResources.get("dragAndDrop"))); submenu.add(new TogglePropertyItem(graphComponent, mxResources .get("dragEnabled"), "DragEnabled")); submenu.add(new TogglePropertyItem(graph, mxResources .get("dropEnabled"), "DropEnabled")); submenu.addSeparator(); submenu.add(new TogglePropertyItem(graphComponent.getGraphHandler(), mxResources.get("imagePreview"), "ImagePreview")); submenu = (JMenu) menu.add(new JMenu(mxResources.get("labels"))); submenu.add(new TogglePropertyItem(graph, mxResources.get("htmlLabels"), "HtmlLabels", true)); submenu.add(new TogglePropertyItem(graph, mxResources.get("showLabels"), "LabelsVisible", true)); submenu.addSeparator(); submenu.add(new TogglePropertyItem(graph, mxResources .get("moveEdgeLabels"), "EdgeLabelsMovable")); submenu.add(new TogglePropertyItem(graph, mxResources .get("moveVertexLabels"), "VertexLabelsMovable")); submenu.addSeparator(); submenu.add(new TogglePropertyItem(graphComponent, mxResources.get("handleReturn"), "EnterStopsCellEditing")); menu.addSeparator(); submenu = (JMenu) menu.add(new JMenu(mxResources.get("connections"))); submenu.add(new TogglePropertyItem(graphComponent, mxResources .get("connectable"), "Connectable")); submenu.add(new TogglePropertyItem(graph, mxResources .get("connectableEdges"), "ConnectableEdges")); submenu.addSeparator(); submenu.add(new ToggleCreateTargetItem(editor, mxResources .get("createTarget"))); submenu.add(editor.bind(mxResources.get("connectMode"), new ToggleConnectModeAction())); submenu = (JMenu) menu.add(new JMenu(mxResources.get("validation"))); submenu.add(new TogglePropertyItem(graph, mxResources .get("allowDanglingEdges"), "AllowDanglingEdges")); submenu.add(new TogglePropertyItem(graph, mxResources .get("cloneInvalidEdges"), "CloneInvalidEdges")); submenu.addSeparator(); submenu.add(new TogglePropertyItem(graph, mxResources.get("allowLoops"), "AllowLoops")); submenu.add(new TogglePropertyItem(graph, mxResources.get("multigraph"), "Multigraph")); submenu.addSeparator(); submenu.add(new TogglePropertyItem(graph, mxResources .get("disconnectOnMove"), "DisconnectOnMove")); // Creates the window menu menu = add(new JMenu(mxResources.get("window"))); UIManager.LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels(); for (int i = 0; i < lafs.length; i++) { final String clazz = lafs[i].getClassName(); menu.add(new AbstractAction(lafs[i].getName()) { public void actionPerformed(ActionEvent e) { editor.setLookAndFeel(clazz); } }); } // Creates the help menu menu = add(new JMenu(mxResources.get("help"))); item = menu.add(new JMenuItem(mxResources.get("aboutGraphEditor"))); item.addActionListener(new ActionListener() { /* * (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent e) { editor.about(); } }); } /** * Adds menu items to the given shape menu. This is factored out because * the shape menu appears in the menubar and also in the popupmenu. */ public static void populateShapeMenu(JMenu menu, BasicGraphEditor editor) { menu.add(editor.bind(mxResources.get("home"), mxGraphActions .getHomeAction(), "/com/mxgraph/swing/examples/images/house.gif")); menu.addSeparator(); menu.add(editor.bind(mxResources.get("exitGroup"), mxGraphActions .getExitGroupAction(), "/com/mxgraph/swing/examples/images/up.gif")); menu.add(editor.bind(mxResources.get("enterGroup"), mxGraphActions .getEnterGroupAction(), "/com/mxgraph/swing/examples/images/down.gif")); menu.addSeparator(); menu.add(editor.bind(mxResources.get("group"), mxGraphActions .getGroupAction(), "/com/mxgraph/swing/examples/images/group.gif")); menu.add(editor.bind(mxResources.get("ungroup"), mxGraphActions .getUngroupAction(), "/com/mxgraph/swing/examples/images/ungroup.gif")); menu.addSeparator(); menu.add(editor.bind(mxResources.get("removeFromGroup"), mxGraphActions .getRemoveFromParentAction())); menu.addSeparator(); menu.add(editor.bind(mxResources.get("collapse"), mxGraphActions .getCollapseAction(), "/com/mxgraph/swing/examples/images/collapse.gif")); menu.add(editor.bind(mxResources.get("expand"), mxGraphActions .getExpandAction(), "/com/mxgraph/swing/examples/images/expand.gif")); menu.addSeparator(); menu.add(editor.bind(mxResources.get("toBack"), mxGraphActions .getToBackAction(), "/com/mxgraph/swing/examples/images/toback.gif")); menu.add(editor.bind(mxResources.get("toFront"), mxGraphActions .getToFrontAction(), "/com/mxgraph/swing/examples/images/tofront.gif")); menu.addSeparator(); JMenu submenu = (JMenu) menu.add(new JMenu(mxResources.get("align"))); submenu.add(editor.bind(mxResources.get("left"), new AlignCellsAction( mxConstants.ALIGN_LEFT), "/com/mxgraph/swing/examples/images/alignleft.gif")); submenu.add(editor.bind(mxResources.get("center"), new AlignCellsAction(mxConstants.ALIGN_CENTER), "/com/mxgraph/swing/examples/images/aligncenter.gif")); submenu.add(editor.bind(mxResources.get("right"), new AlignCellsAction( mxConstants.ALIGN_RIGHT), "/com/mxgraph/swing/examples/images/alignright.gif")); submenu.addSeparator();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -