📄 editormenubar.java
字号:
submenu.add(editor.bind(mxResources.get("top"), new AlignCellsAction( mxConstants.ALIGN_TOP), "/com/mxgraph/swing/examples/images/aligntop.gif")); submenu.add(editor.bind(mxResources.get("middle"), new AlignCellsAction(mxConstants.ALIGN_MIDDLE), "/com/mxgraph/swing/examples/images/alignmiddle.gif")); submenu.add(editor.bind(mxResources.get("bottom"), new AlignCellsAction(mxConstants.ALIGN_BOTTOM), "/com/mxgraph/swing/examples/images/alignbottom.gif")); menu.addSeparator(); menu .add(editor.bind(mxResources.get("autosize"), new AutosizeAction())); } /** * Adds menu items to the given format menu. This is factored out because * the format menu appears in the menubar and also in the popupmenu. */ public static void populateFormatMenu(JMenu menu, BasicGraphEditor editor) { JMenu submenu = (JMenu) menu.add(new JMenu(mxResources .get("background"))); submenu.add(editor.bind(mxResources.get("fillcolor"), new ColorAction( "Fillcolor", mxConstants.STYLE_FILLCOLOR), "/com/mxgraph/swing/examples/images/fillcolor.gif")); submenu.add(editor.bind(mxResources.get("gradient"), new ColorAction( "Gradient", mxConstants.STYLE_GRADIENTCOLOR))); submenu.addSeparator(); submenu.add(editor.bind(mxResources.get("image"), new PromptValueAction(mxConstants.STYLE_IMAGE, "Image"))); submenu.add(editor.bind(mxResources.get("shadow"), new ToggleAction( mxConstants.STYLE_SHADOW))); submenu.addSeparator(); submenu.add(editor.bind(mxResources.get("opacity"), new PromptValueAction(mxConstants.STYLE_OPACITY, "Opacity (0-100)"))); submenu = (JMenu) menu.add(new JMenu(mxResources.get("label"))); submenu.add(editor.bind(mxResources.get("fontcolor"), new ColorAction( "Fontcolor", mxConstants.STYLE_FONTCOLOR), "/com/mxgraph/swing/examples/images/fontcolor.gif")); submenu.addSeparator(); submenu.add(editor.bind(mxResources.get("labelFill"), new ColorAction( "Label Fill", mxConstants.STYLE_LABEL_BACKGROUNDCOLOR))); submenu.add(editor.bind(mxResources.get("labelBorder"), new ColorAction("Label Border", mxConstants.STYLE_LABEL_BORDERCOLOR))); submenu.addSeparator(); submenu.add(editor.bind(mxResources.get("rotateLabel"), new ToggleAction(mxConstants.STYLE_HORIZONTAL, true))); submenu.add(editor.bind(mxResources.get("textOpacity"), new PromptValueAction(mxConstants.STYLE_TEXT_OPACITY, "Opacity (0-100)"))); submenu.addSeparator(); JMenu subsubmenu = (JMenu) submenu.add(new JMenu(mxResources .get("position"))); subsubmenu.add(editor.bind(mxResources.get("top"), new SetLabelPositionAction(mxConstants.ALIGN_TOP, mxConstants.ALIGN_BOTTOM))); subsubmenu.add(editor.bind(mxResources.get("middle"), new SetLabelPositionAction(mxConstants.ALIGN_MIDDLE, mxConstants.ALIGN_MIDDLE))); subsubmenu.add(editor.bind(mxResources.get("bottom"), new SetLabelPositionAction(mxConstants.ALIGN_BOTTOM, mxConstants.ALIGN_TOP))); subsubmenu.addSeparator(); subsubmenu.add(editor.bind(mxResources.get("left"), new SetLabelPositionAction(mxConstants.ALIGN_LEFT, mxConstants.ALIGN_RIGHT))); subsubmenu.add(editor.bind(mxResources.get("center"), new SetLabelPositionAction(mxConstants.ALIGN_CENTER, mxConstants.ALIGN_CENTER))); subsubmenu.add(editor.bind(mxResources.get("right"), new SetLabelPositionAction(mxConstants.ALIGN_RIGHT, mxConstants.ALIGN_LEFT))); submenu.addSeparator(); submenu.add(editor.bind(mxResources.get("hide"), new ToggleAction( mxConstants.STYLE_NOLABEL))); menu.addSeparator(); submenu = (JMenu) menu.add(new JMenu(mxResources.get("line"))); submenu.add(editor.bind(mxResources.get("linecolor"), new ColorAction( "Linecolor", mxConstants.STYLE_STROKECOLOR), "/com/mxgraph/swing/examples/images/linecolor.gif")); submenu.addSeparator(); submenu.add(editor.bind(mxResources.get("dashed"), new ToggleAction( mxConstants.STYLE_DASHED))); submenu.add(editor.bind(mxResources.get("linewidth"), new PromptValueAction(mxConstants.STYLE_STROKEWIDTH, "Linewidth"))); submenu = (JMenu) menu.add(new JMenu(mxResources.get("connector"))); submenu.add(editor.bind(mxResources.get("straight"), new SetStyleAction("straight"), "/com/mxgraph/swing/examples/images/straight.gif")); submenu.add(editor.bind(mxResources.get("horizontal"), new SetStyleAction(""), "/com/mxgraph/swing/examples/images/connect.gif")); submenu.add(editor.bind(mxResources.get("vertical"), new SetStyleAction("vertical"), "/com/mxgraph/swing/examples/images/vertical.gif")); submenu.addSeparator(); submenu.add(editor.bind(mxResources.get("entityRelation"), new SetStyleAction("edgeStyle=mxEdgeStyle.EntityRelation"), "/com/mxgraph/swing/examples/images/entity.gif")); submenu.add(editor.bind(mxResources.get("arrow"), new SetStyleAction( "arrow"), "/com/mxgraph/swing/examples/images/arrow.gif")); submenu.addSeparator(); submenu.add(editor.bind(mxResources.get("plain"), new ToggleAction( mxConstants.STYLE_NOEDGESTYLE))); menu.addSeparator(); submenu = (JMenu) menu.add(new JMenu(mxResources.get("linestart"))); submenu.add(editor.bind(mxResources.get("open"), new KeyValueAction( mxConstants.STYLE_STARTARROW, mxConstants.ARROW_OPEN), "/com/mxgraph/swing/examples/images/open_start.gif")); submenu.add(editor.bind(mxResources.get("classic"), new KeyValueAction( mxConstants.STYLE_STARTARROW, mxConstants.ARROW_CLASSIC), "/com/mxgraph/swing/examples/images/classic_start.gif")); submenu.add(editor.bind(mxResources.get("block"), new KeyValueAction( mxConstants.STYLE_STARTARROW, mxConstants.ARROW_BLOCK), "/com/mxgraph/swing/examples/images/block_start.gif")); submenu.addSeparator(); submenu.add(editor.bind(mxResources.get("diamond"), new KeyValueAction( mxConstants.STYLE_STARTARROW, mxConstants.ARROW_DIAMOND), "/com/mxgraph/swing/examples/images/diamond_start.gif")); submenu.add(editor.bind(mxResources.get("oval"), new KeyValueAction( mxConstants.STYLE_STARTARROW, mxConstants.ARROW_OVAL), "/com/mxgraph/swing/examples/images/oval_start.gif")); submenu.addSeparator(); submenu.add(editor.bind(mxResources.get("none"), new KeyValueAction( mxConstants.STYLE_STARTARROW, mxConstants.NONE))); submenu.add(editor.bind(mxResources.get("size"), new PromptValueAction( mxConstants.STYLE_STARTSIZE, "Linestart Size"))); submenu = (JMenu) menu.add(new JMenu(mxResources.get("lineend"))); submenu.add(editor.bind(mxResources.get("open"), new KeyValueAction( mxConstants.STYLE_ENDARROW, mxConstants.ARROW_OPEN), "/com/mxgraph/swing/examples/images/open_end.gif")); submenu.add(editor.bind(mxResources.get("classic"), new KeyValueAction( mxConstants.STYLE_ENDARROW, mxConstants.ARROW_CLASSIC), "/com/mxgraph/swing/examples/images/classic_end.gif")); submenu.add(editor.bind(mxResources.get("block"), new KeyValueAction( mxConstants.STYLE_ENDARROW, mxConstants.ARROW_BLOCK), "/com/mxgraph/swing/examples/images/block_end.gif")); submenu.addSeparator(); submenu.add(editor.bind(mxResources.get("diamond"), new KeyValueAction( mxConstants.STYLE_ENDARROW, mxConstants.ARROW_DIAMOND), "/com/mxgraph/swing/examples/images/diamond_end.gif")); submenu.add(editor.bind(mxResources.get("oval"), new KeyValueAction( mxConstants.STYLE_ENDARROW, mxConstants.ARROW_OVAL), "/com/mxgraph/swing/examples/images/oval_end.gif")); submenu.addSeparator(); submenu.add(editor.bind(mxResources.get("none"), new KeyValueAction( mxConstants.STYLE_ENDARROW, mxConstants.NONE))); submenu.add(editor.bind(mxResources.get("size"), new PromptValueAction( mxConstants.STYLE_ENDSIZE, "Linestart Size"))); menu.addSeparator(); submenu = (JMenu) menu.add(new JMenu(mxResources.get("alignment"))); submenu.add(editor.bind(mxResources.get("left"), new KeyValueAction( mxConstants.STYLE_ALIGN, mxConstants.ALIGN_LEFT), "/com/mxgraph/swing/examples/images/left.gif")); submenu.add(editor.bind(mxResources.get("center"), new KeyValueAction( mxConstants.STYLE_ALIGN, mxConstants.ALIGN_CENTER), "/com/mxgraph/swing/examples/images/center.gif")); submenu.add(editor.bind(mxResources.get("right"), new KeyValueAction( mxConstants.STYLE_ALIGN, mxConstants.ALIGN_RIGHT), "/com/mxgraph/swing/examples/images/right.gif")); submenu.addSeparator(); submenu.add(editor.bind(mxResources.get("top"), new KeyValueAction( mxConstants.STYLE_VERTICAL_ALIGN, mxConstants.ALIGN_TOP), "/com/mxgraph/swing/examples/images/top.gif")); submenu.add(editor.bind(mxResources.get("middle"), new KeyValueAction( mxConstants.STYLE_VERTICAL_ALIGN, mxConstants.ALIGN_MIDDLE), "/com/mxgraph/swing/examples/images/middle.gif")); submenu.add(editor.bind(mxResources.get("bottom"), new KeyValueAction( mxConstants.STYLE_VERTICAL_ALIGN, mxConstants.ALIGN_BOTTOM), "/com/mxgraph/swing/examples/images/bottom.gif")); submenu = (JMenu) menu.add(new JMenu(mxResources.get("spacing"))); submenu.add(editor.bind(mxResources.get("top"), new PromptValueAction( mxConstants.STYLE_SPACING_TOP, "Top Spacing"))); submenu.add(editor.bind(mxResources.get("right"), new PromptValueAction(mxConstants.STYLE_SPACING_RIGHT, "Right Spacing"))); submenu.add(editor.bind(mxResources.get("bottom"), new PromptValueAction(mxConstants.STYLE_SPACING_BOTTOM, "Bottom Spacing"))); submenu.add(editor.bind(mxResources.get("left"), new PromptValueAction( mxConstants.STYLE_SPACING_LEFT, "Left Spacing"))); submenu.addSeparator(); submenu.add(editor.bind(mxResources.get("global"), new PromptValueAction(mxConstants.STYLE_SPACING, "Spacing"))); submenu.addSeparator(); submenu.add(editor.bind(mxResources.get("sourceSpacing"), new PromptValueAction( mxConstants.STYLE_SOURCE_PERIMETER_SPACING, mxResources .get("sourceSpacing")))); submenu.add(editor.bind(mxResources.get("targetSpacing"), new PromptValueAction( mxConstants.STYLE_TARGET_PERIMETER_SPACING, mxResources .get("targetSpacing")))); submenu.addSeparator(); submenu.add(editor.bind(mxResources.get("perimeter"), new PromptValueAction(mxConstants.STYLE_PERIMETER_SPACING, "Perimeter Spacing"))); submenu = (JMenu) menu.add(new JMenu(mxResources.get("direction"))); submenu.add(editor.bind(mxResources.get("north"), new KeyValueAction( mxConstants.STYLE_DIRECTION, mxConstants.DIRECTION_NORTH))); submenu.add(editor.bind(mxResources.get("east"), new KeyValueAction( mxConstants.STYLE_DIRECTION, mxConstants.DIRECTION_EAST))); submenu.add(editor.bind(mxResources.get("south"), new KeyValueAction( mxConstants.STYLE_DIRECTION, mxConstants.DIRECTION_SOUTH))); submenu.add(editor.bind(mxResources.get("west"), new KeyValueAction( mxConstants.STYLE_DIRECTION, mxConstants.DIRECTION_WEST))); submenu.addSeparator(); submenu.add(editor.bind(mxResources.get("rotation"), new PromptValueAction(mxConstants.STYLE_ROTATION, "Rotation (0-360)"))); menu.addSeparator(); menu.add(editor.bind(mxResources.get("rounded"), new ToggleAction( mxConstants.STYLE_ROUNDED))); menu.add(editor.bind(mxResources.get("style"), new StyleAction())); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -