Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/381.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在mxgraph中更改mxCell和mxPoint之间的边样式?_Java_Swing_Classcastexception_Edges_Jgraphx - Fatal编程技术网

Java 如何在mxgraph中更改mxCell和mxPoint之间的边样式?

Java 如何在mxgraph中更改mxCell和mxPoint之间的边样式?,java,swing,classcastexception,edges,jgraphx,Java,Swing,Classcastexception,Edges,Jgraphx,我正在尝试使用特定的边样式(默认样式除外)绘制边。问题是我在一个单元和一个点之间画了一条边,这样边看起来就像是从一个单元到图形中的一个空间 edge = graph.insertEdge(parentCell, null, label, myCell,null); 我得到一个例外: "java.lang.ClassCastException: com.mxgraph.util.mxPoint cannot be cast to com.mxgraph.model.mxICell" edge.

我正在尝试使用特定的边样式(默认样式除外)绘制边。问题是我在一个单元和一个点之间画了一条边,这样边看起来就像是从一个单元到图形中的一个空间

edge = graph.insertEdge(parentCell, null, label, myCell,null);
我得到一个例外:

"java.lang.ClassCastException: com.mxgraph.util.mxPoint cannot be cast to com.mxgraph.model.mxICell"
edge.geometry.setTerminalPoint(termPoint, true);
当我使用此代码时:

mxGeometry geoCell = myCell.getGeometry();
mxPoint termPoint = new mxPoint(geoCell.getX() - (120 - (offset)), geoCell.getY() + 100);
graph.insertEdge(parentCell, null, "", myCell, termPoint, "edgeStyle=elbowEdgeStyle;elbow=horizontal;orthogonal=0;");

我使用的是jgraphx1.10。有什么东西可以替换该点而不会出错并给出连接到空间的边的外观吗?

尝试在边的几何体上设置端点,您不能将该点用作源端子,因为它应该是一个单元(请参见例外):


如果您试图在终端和边缘之间实现一个间距,您也可以对顶点使用
STYLE\u periment\u space
,或对边缘使用
STYLE\u SOURCE/TARGET\u periment\u space

是的,这正是我试图做的。非常感谢。