我想问一下,有没有办法把顶点放在画布上的特定点(x,y)。我想启动一个已经建立了图形的应用程序,但是使用g.addVertex(1)添加顶点到图形,但它被放在画布上的随机点。
发布于 2013-04-19 03:18:46
public static class MyVertex {
private String name;
private int vIndex;
private boolean visited = false;
private int distance = 0;
private double x;
private double y;
public MyVertex(String name, int vIndex) {
this.name = name;
this.vIndex = vIndex;
}
public void setX(double x) {
this.x = x;
}
public double getX() {
return x;
}
public void setY(double y) {
this.y = y;
}
public double getY() {
return y;
}
public String getName() {
return name;
}}
也许这会对你有帮助?我在我的项目中使用了它,它工作得很好!
发布于 2013-03-04 00:48:00
http://jung.sourceforge.net/doc/api/edu/uci/ics/jung/algorithms/layout/AbstractLayout.html
然后是setLocation和lock。
https://stackoverflow.com/questions/15184275
复制相似问题