我正在使用 jgraphx 1.12.0.2,并且正在尝试从代码中重新排列图形的顶点。代码看起来像这样:
Object[] roots = graph.getChildCells(graph.getDefaultParent(), true, false);
graph.getModel().beginUpdate();
for (int i = 0; i < roots.length; i++) {
Object[] root = {roots[i]};
graph.moveCells(root, i * 10 + 5, 50);
/* these two lines were added because I thought they might help with the problem */
/* with or without them, the result is the same */
graph.getView().clear(root, true, true);
graph.getView().validate();
}
graph.refresh();
graph.getModel().endUpdate();
当然,问题是细胞没有移动到指定的位置。可能是什么问题呢?
谢谢!