gpt4 book ai didi

java - 如何更改边缘生根样式

转载 作者:行者123 更新时间:2023-11-30 04:15:09 25 4
gpt4 key购买 nike

我使用 eclipse 作为编辑器和 jgraphx v1.1。我正在尝试将边缘样式更改为sidetoside。由于某种原因,我在 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(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);
}

}

最佳答案

试试这个:

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

关于java - 如何更改边缘生根样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18575959/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com