我正在使用Eclipse / Java 7.我有一个类,它从查询中获取一些值并将它们保存在二维数组路径中。然后我又创建了另一个设计2个链接块的类。我想要做的是从第一个类中获取路径1 [0]和路径[2] [0]等的值,并自动将它们放在设计的块中。有什么想法怎么做?提前致谢
实施例
第一堂课(来自查询的结果):
public class OntoQ extends JFrame {
public static void main(String[] args) {
String[][] path = new String[20][2];
int pathi = 0;
int pathj = 0;
....
二等(设计):
import javax.swing.JFrame;
import com.mxgraph.swing.mxGraphComponent;
import com.mxgraph.view.mxGraph;
public class Design extends JFrame {
public Design() {
super("Test");
mxGraph graph = new mxGraph();
Object parent = graph.getDefaultParent();
graph.getModel().beginUpdate();
try
{
Object v1 = graph.insertVertex(parent, null, "path[1][0]", 20, 20, 80,
30);
Object v2 = graph.insertVertex(parent, null, "path[2][0]" , 240, 150,
80, 30);
graph.insertEdge(parent, null, "Edge", v1, v2);
}
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);
}
}