JGraphX - 改变生根风格 [英] JGraphX - change edge rooting style

查看:185
本文介绍了JGraphX - 改变生根风格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用eclipse作为编辑器和jgraphx v1.1。我正在尝试将边缘风格改为侧面。由于某些原因,我在setStyle中收到错误。我也尝试了edgeStyle [mxConstants.STYLE_EDGE] = mxEdgeStyle.SideToSide,但仍然没有。
任何想法我做错了什么?



提前感谢

  public Design(){


super(Path Followed);

AAA aaa = new AAA();

mxGraph graph = new mxGraph();
Object parent = graph.getDefaultParent();

Object edgeStyle = graph.getStylesheet()。getDefaultEdgeStyle();
graph.setStyle(edgeStyle = mxEdgeStyle.SideToSide,parent);

graph.getModel()。beginUpdate();

int k = 0;

while(toq.path [k] [0]!= null){

try
{


Object v1 = graph.insertVertex(parent,null,aaa.path [k] [0],20,20,80,30);
对象v2 = graph.insertVertex(parent,null,aaa.path [k + 1] [0],20,20,80,30);
graph.insertEdge(parent,null,,v1,v2);
graph.insertEdge(parent,null,,v1,v1);

k ++;
}
finally
{
graph.getModel()。endUpdate();
}
}



mxGraphComponent graphComponent = new mxGraphComponent(graph);
add(graphComponent);


}


public static void main(String [] args)
{
Design frame = new Design );
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400,320);
frame.setVisible(true);
}

}


解决方案

尝试这样:

  Map< String,Object> style = graph.getStylesheet()。getDefaultEdgeStyle(); 
style.put(mxConstants.STYLE_EDGE,mxEdgeStyle.SideToSide);


I am using eclipse as editor and jgraphx v1.1. I am trying to change the edge style to sidetoside. For some reason I keep getting errors in setStyle. I have also tried edgeStyle[mxConstants.STYLE_EDGE] = mxEdgeStyle.SideToSide but still nothing. Any ideas what I do wrong?

Thanks in advance

public Design() {


        super("Path Followed");

        AAA aaa = new AAA() ;

        mxGraph graph = new mxGraph();
        Object parent = graph.getDefaultParent();

        Object edgeStyle = graph.getStylesheet().getDefaultEdgeStyle() ;
            graph.setStyle(edgeStyle=mxEdgeStyle.SideToSide, parent) ;

        graph.getModel().beginUpdate();

        int k = 0 ;

        while(ontoq.path[k][0] != null) {

        try
        {


            Object v1 = graph.insertVertex(parent, null, aaa.path[k][0], 20, 20, 80, 30);
            Object v2 = graph.insertVertex(parent, null, aaa.path[k+1][0], 20, 20, 80, 30);
            graph.insertEdge(parent, null, " ", v1, v2);
            graph.insertEdge(parent, null, " ", v1, v1);

            k++ ;
        }
        finally
        {
            graph.getModel().endUpdate();
        }
    }



        mxGraphComponent graphComponent = new mxGraphComponent(graph);
        add(graphComponent);


    }


    public static void main(String[] args)
    {
        Design frame = new Design();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(400, 320);
        frame.setVisible(true);
    }

}

解决方案

Try this:

Map<String, Object> style = graph.getStylesheet().getDefaultEdgeStyle();
style.put(mxConstants.STYLE_EDGE, mxEdgeStyle.SideToSide);

这篇关于JGraphX - 改变生根风格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆