Package com.mxgraph.examples.swing.editor.EditorActions

Examples of com.mxgraph.examples.swing.editor.EditorActions.ColorAction


  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/examples/swing/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/examples/swing/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("wordWrap"),
        new KeyValueAction(mxConstants.STYLE_WHITE_SPACE, "wrap")));
    submenu.add(editor.bind(mxResources.get("noWordWrap"),
        new KeyValueAction(mxConstants.STYLE_WHITE_SPACE, null)));

    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/examples/swing/images/linecolor.gif"));

    submenu.addSeparator();
View Full Code Here


        mxConstants.ALIGN_RIGHT),
        "/com/mxgraph/examples/swing/images/right.gif"));

    addSeparator();

    add(editor.bind("Font", new ColorAction("Font",
        mxConstants.STYLE_FONTCOLOR),
        "/com/mxgraph/examples/swing/images/fontcolor.gif"));
    add(editor.bind("Stroke", new ColorAction("Stroke",
        mxConstants.STYLE_STROKECOLOR),
        "/com/mxgraph/examples/swing/images/linecolor.gif"));
    add(editor.bind("Fill", new ColorAction("Fill",
        mxConstants.STYLE_FILLCOLOR),
        "/com/mxgraph/examples/swing/images/fillcolor.gif"));

    addSeparator();
View Full Code Here

   */
  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/examples/swing/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/examples/swing/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("wordWrap"), new KeyValueAction(mxConstants.STYLE_WHITE_SPACE, "wrap")));
    submenu.add(editor.bind(mxResources.get("noWordWrap"), new KeyValueAction(mxConstants.STYLE_WHITE_SPACE, null)));

    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/examples/swing/images/linecolor.gif"));

    submenu.addSeparator();

    submenu.add(editor.bind(mxResources.get("orthogonal"), new ToggleAction(mxConstants.STYLE_ORTHOGONAL)));
View Full Code Here

TOP

Related Classes of com.mxgraph.examples.swing.editor.EditorActions.ColorAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.