0

I am using Eclipse/Java 7. I have a class, which gets some values from queries and saves them in the 2 dimensional array path. Then I have made another class which designs 2 linked blocks. What I want to do is get the values of path1[0] and path[2][0] etc from the first class and automatically place them in the designed blocks. Any ideas how to do it? Thanks in advance

Example enter image description here

1st class (results from queries):

public class OntoQ extends JFrame {

    public static void main(String[] args) {


    String[][] path = new String[20][2];
    int pathi = 0;
    int pathj = 0;
....

2nd class (design):

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);
    }

}
Frodo Baggins
  • 8,290
  • 6
  • 45
  • 55
user2598911
  • 379
  • 2
  • 6
  • 22
  • This is basic [paramter passing](http://docs.oracle.com/javase/tutorial/java/javaOO/arguments.html), which you are already doing – MadProgrammer Sep 01 '13 at 20:22
  • Nope it hasnt worked out for me yet – user2598911 Sep 02 '13 at 08:08
  • 1
    See your main method. It's passing an array of Strings from the command line to your program. Maybe you can use something like that to pass parameters to your other class, perhaps via the constructor – MadProgrammer Sep 02 '13 at 09:23

0 Answers0