How to open a Jung Frame class using JBUtton

61 views Asked by At

I have created a class called "Display"and one JFrame class called"SimpleGraphicView" which uses jung2. I am trying to create a button that opens the JFrame. I have tried the following code

JButton btnInteractions = new JButton("DNetwork");
    btnInteractions.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            if (comboBox.getSelectedItem().toString()
                    .equals("Hereditery Breast Cancer")) {
                SimpleGraphicView frame = new SimpleGraphicView();
                frame.setExtendedState(JFrame.NORMAL);
                frame.setSize(600, 600);
                frame.setVisible(true);
                frame.getContentPane();
            }

In the JUung Frame Class

public void run() {
            try {
                SimpleGraphicView frame = new SimpleGraphicView();
                frame.setVisible(true);
                frame.getContentPane().***add(vv);***
                frame.pack();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });

But the content in Jung2 Frame is not displaying. How can I do this???

0

There are 0 answers