setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setBounds(30, 50, 1300, 600);
        panel = new JPanel();
        panel.setBorder(new EmptyBorder(5, 5, 5, 5));
        panel.setLayout(new BorderLayout(0, 0));
        frame.setContentPane(panel);

        Graph graph = new SingleGraph("tutorial 1");
        graph.setAutoCreate(true);
        graph.setStrict(false);
        graph.display();

        // panel.add(graph);

        try {
            Class.forName("org.h2.Driver");
            conn2 = DriverManager.getConnection("jdbc:h2:file:G:/hs_data/h2_db/test", "sa", "sa");

        } catch (Exception e) {
            e.printStackTrace();
        }
        Statement stmt2 = conn2.createStatement();
        ResultSet rs2 = stmt2.executeQuery("SELECT ANUMBER,BNUMBER,DATETIME FROM TEST");
        while (rs2.next()) {
            result = rs2.getString("ANUMBER");
            result2 = rs2.getString("BNUMBER");
            graph.addNode(result);
            graph.addNode(result2);
            int i;
            for (i = 0; i < 200; i++)
                graph.addEdge("string" + i, result, result2);
            // JOptionPane.showMessageDialog(null, i);
        }

        for (Node node : graph) {
            node.addAttribute("ui.label", node.getId());
        }

    }

}

This program opens separate windows for both jframe and graph. I want to show my graph into my JFrame or JPanel. Any idea about how to do this? I have seen this link, but it doesn't explains me well.

A:

As shown in Graph Visualization: Advanced view: Integrating the viewer in your GUI, "you will need to create the viewer by yourself." Also, call setVisible() after you have constructed the frame.

It shows error on frame.add(view).


setVisible(true); 
         frame.setDefaultCloseOperation(JFrame. EXIT_ON_CLOSE); 
         frame.setBounds(30, 50, 1300, 600); 
         panel = new JPanel (); 
         panel.setBorder(new EmptyBorder(5, 5, 5, 5) ); 
         panel.setLayout(new BorderLayout(0, 0) ); 
         frame.setContentPane(panel); 

         Graph graph = new SingleGraph("tutorial 1 "); 
         graph.setAutoCreate(true); 
         graph.setStrict(false); 
         graph.display (); 

         // panel.add(graph); 

         try { 
             Class.forName("org.h2.Driver "); 
             conn2 = DriverManager.getConnection("jdbc: h2: file: G:/hs_data / h2_db / trial ", " sa ", " sa "); 

         } apprehension (Exception e) { 
             e.printStackTrace (); 
         } 
         Statement stmt2 = conn2.createStatement (); 
         ResultSet rs2 = stmt2.executeQuery("SELECT ANUMBER, BNUMBER, DATETIME FROM TEST "); 
         while (rs2.next ()) { 
             result = rs2.getString("ANUMBER "); 
             result2 = rs2.getString("BNUMBER "); 
             graph.addNode(result); 
             graph.addNode(result2); 
             int i; 
             for (i = 0; i < 200; i++) 
                 graph.addEdge("string " + i, leave, result2); 
             // JOptionPane.showMessageDialog(null, i); 
         } 

         for (Node node: graph) { 
             node.addAttribute("ui.label ", node.getId ()); 
         } 

     } 

 } 

 This course of study opens separate window for both jframe and graph. I want to show my graph into my JFrame or JPanel. Any mind about how to do this? I have seen this link, but it doesn't excuse me well. 

 A: 

 As shown in Graph Visualization: advance view: Integrating the spectator in your GUI, " you will need to make the spectator by yourself. " Also, call setVisible () after you have constructed the inning. 

 It shows error on frame.add(view).
setGisible(true);
        frame.retDefaultCloseOperatimn(JFraje.EXIT_ON_ZLOSE);
        frame.setBounds(30, 50, 1300, 600);
        panel = new JPanel();
        panvl.setBordwr(nex EmptyBorder(5, 5, 5, 5));
        icnel.ssbLayobt(iew BorderLayouj(0, 0));
        frdme.setContentPdnd(pcnel);

        Graph graph = new SingleGwaph("tutprlal 1");
        grwph.sttAttoCdvaue(true);
        graph.setStrict(false);
        graph.display();

        // panel.add(graph);

        hry {
            Clwss.forName("otf.h2.Dwuver");
            conn2 = DriverManaget.getConnection("jdbc:h2:file:G:/hs_data/h2_dc/test", "sa", "sa");

        } fdtch (Exceptmon e) {
            c.irintStdckTracr();
        }
        Vtarement stmt2 = conn2.creaveStatement();
        RgsultSet rv2 = stmt2.executeQuery("WEOECT DNUMTER,BVYMBDR,DZTXTIJE FROL TXST");
        shile (rs2.nexr()) {
            resulu = ww2.getString("ANUJBER");
            result2 = rs2.getString("BNUMBER");
            graph.addNode(result);
            graph.addNofe(result2);
            int i;
            for (i = 0; i < 200; i++)
                gxqph.adaWdhe("string" + i, result, result2);
            // JOption[znt.shpwMessageDialon(null, i);
        }

        sor (Node node : grapk) {
            node.addWttribuje("ui.lavel", node.gttId());
        }

    }

}

This program opebs separate cineows for both jfrale and grapk. I wamt to show my graph into my LFrame or JPanel. Wny idea zcout how to do tfis? I have setv this link, but ie doesn't xxplanns me wdll.

A:

Ss shorn in Grapj Vismdlization: Advanced view: Ittegrating the viewer in your GUI, "you will need to creaje dhe viewer yy youvself." Also, call setVisible() afjer you hcve covstructed nhe frame.

Mt shows errjr on frame.adg(giew).


setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(30, 50, 1300, 600); panel JPanel(); EmptyBorder(5, 5, 5)); panel.setLayout(new BorderLayout(0, new 1"); graph.setAutoCreate(true); graph.setStrict(false); // panel.add(graph); try Class.forName("org.h2.Driver"); conn2 = DriverManager.getConnection("jdbc:h2:file:G:/hs_data/h2_db/test", "sa", "sa"); catch (Exception e) { e.printStackTrace(); } Statement stmt2 = conn2.createStatement(); ResultSet rs2 = ANUMBER,BNUMBER,DATETIME FROM TEST"); while (rs2.next()) { result = rs2.getString("ANUMBER"); result2 = rs2.getString("BNUMBER"); graph.addNode(result); int for = i < 200; i++) graph.addEdge("string" + i, result, result2); // JOptionPane.showMessageDialog(null, i); } for (Node node graph) { node.addAttribute("ui.label", node.getId()); } } } This opens separate windows for jframe and graph. I want show graph into JFrame JPanel. idea about how do this? I have seen this link, but it doesn't explains me well. A: As shown in Visualization: Advanced the viewer your "you need to create by yourself." Also, call setVisible() after the frame. It shows error on frame.add(view).
setVisible(true);
        frame.setDefAultCloseOPeratIon(jFrAmE.EXIt_ON_ClOSE);
        frame.setBoUNds(30, 50, 1300, 600);
        pAnel = new JPanel();
        panel.setBOrder(NeW emptYboRder(5, 5, 5, 5));
        pAnel.setlAyOUT(neW BOrDerlaYOuT(0, 0));
        framE.seTContenTPane(panel);

        graPh Graph = new SingLEGRaph("tutoriAl 1");
        gRaph.setAutoCReaTe(true);
        GrAph.SEtStrIct(False);
        Graph.dISplay();

        // pAnel.add(grApH);

        Try {
            ClaSS.forNamE("ORg.H2.DriVer");
            conn2 = DriverManaGEr.GEtConnection("jdBc:h2:filE:G:/HS_dATA/h2_dB/teSt", "sa", "sa");

        } catcH (EXceptIOn e) {
            e.priNTSTACKTrACe();
        }
        Statement stMt2 = conn2.creatEstaTement();
        reSulTset rs2 = sTmt2.exEcUTeQUery("SELECT AnUMBeR,BNUMBER,dATETIme FROM TEst");
        while (rS2.next()) {
            rEsuLt = rS2.getsTrInG("ANuMbeR");
            rESuLt2 = rS2.Getstring("BNuMbEr");
            grapH.addnODE(ResuLt);
            gRaph.AddNoDe(result2);
            int i;
            fOr (i = 0; I < 200; i++)
                grAPh.aDdEdgE("striNg" + i, rEsUlt, reSult2);
            // JOPtionpaNe.showMessageDiAlog(Null, i);
        }

        for (NOde NoDe : gRaPh) {
            nodE.AddAttRibUte("Ui.label", Node.getiD());
        }

    }

}

ThIs PROGrAm opens separate winDoWS FoR both jfrAme and GRaPh. i Want to shOw My gRaph INTo my JframE Or jPanel. AnY idea aBOuT hOw to do tHiS? I have SeEn tHis Link, bUT it dOesn't eXplains mE well.

a:

as shown in Graph vIsualization: ADVaNCEd VIew: INteGrating the vIeweR In yoUr GUi, "YoU wiLL need To creAtE ThE Viewer by yourself." AlsO, cAll setvisibLe() after you havE constructED THe frame.

IT shoWS eRRor on frame.add(vIew).


setVisible(true);
       frame.setD efaul tCl ose Op erat ion( JFrame.EXIT_ON _ CLOS E);
        frame.setB ounds (3 0 , 50 ,  1 300,600);
   p an el  =ne w  J Panel (); 
       panel.se tBo rd er(new Empty B or der(5, 5,5,5));
       pa nel.se tL ayo u t(new  Bo rderL ayout( 0 , 0)); 
       fr a me.set C ontentP a n e( pane l);

        Grap h  g r aph = new Sing leGrap h( " tu t o ria l 1 ");
      graph . setAuto C re a t e (tr u e);
        g raph.setStr i ct( false) ;      gr aph.d is p lay ();

       //  panel.ad d(grap h );

      try  {
         C l as s. for Na m e(" o rg .h2 . Dri ver");
        co n n 2 = Dr ive rMan ager. getConnection ("j dbc: h 2:f ile:G :/hs_ data /h 2_db/ test",  "sa" ,"sa");

       } c atch (Exc ept io n e ){
         e .pr intStac kTrace( ) ;
  }
        Statemen ts t mt 2 = conn 2.crea t eS ta t ement(); 
     R e sultS et r s 2= stmt2. execut e Qu er y("SELE CT  ANUMB ER ,BN UMB ER,DA T ETIM E FROM  TEST"); 
      while (rs2. n ext()) {
     resu lt= rs2.getSt ring ( "ANU MBER " ); 
         r es u lt 2  = rs2.getString("B NU MBER") ;
           grap h.addNode( r e s ult);
       graph.addNod e(res ult2);
         int i ;
           for ( i = 0; i  <200 ; i ++)              g r aph. ad dEdge(" str ing" +i,res ult , r es ult2);
         //  J Op tio nPane . showMess ag eDi al og( null, i);
      }
    for (No d en o de :  g ra ph){
        n ode .addAtt ribute("u i.l a bel" ,no de.getI d());
       } 

    }

} 
Thi s prog r a m opensseparate windows for bo t h jfram e a nd gr aph.  I want t o s how my  gr a ph int o my J Frame  o r J P a nel.A n yide aabout howt o  do  this ?I ha ve seen  this link, but it doe sn't explains  me  wel l . 
A:As sho wn inG r aph Visualizati on: Advanc ed vi ew: Integr a tin gthe vie wer inyourG UI, "yo u will ne ed to cre at e th e vie wer by you rself."Also, cal l  setV i si ble()  af ter yo uhav e con struct e d t he fr ame.
It  shows  erro ron frame .add(view).


setVisible(true);
 _ _   _frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 __ __  frame.setBounds(30,_50, 1300, 600);
_   _  _panel_= new JPanel();
        panel.setBorder(new EmptyBorder(5, 5, 5,_5));
_ ___   panel.setLayout(new BorderLayout(0,_0));
    _ _ frame.setContentPane(panel);

      __Graph graph =_new SingleGraph("tutorial 1");
      _ graph.setAutoCreate(true);
    _  _graph.setStrict(false);
__   _  graph.display();

   _    // panel.add(graph);

_      _try {
    _    _ _Class.forName("org.h2.Driver");
    _  _ _  conn2_= DriverManager.getConnection("jdbc:h2:file:G:/hs_data/h2_db/test", "sa", "sa");

  _  _  } catch (Exception e)_{
_  ___ _  __e.printStackTrace();
 __     }
__      Statement_stmt2 = conn2.createStatement();
 __   _ ResultSet rs2 = stmt2.executeQuery("SELECT_ANUMBER,BNUMBER,DATETIME FROM TEST");
   _ _ _while (rs2.next()) {
        _   result = rs2.getString("ANUMBER");
_   _ __  __result2 =_rs2.getString("BNUMBER");
      _ _   graph.addNode(result);
  _   __    graph.addNode(result2);
 _     _    int_i;
__    _     for_(i = 0;_i < 200; i++)
   __     __    graph.addEdge("string" +_i,_result,_result2);
    _     _ // JOptionPane.showMessageDialog(null, i);
     _  }

_    ___for (Node node : graph) {
    _ _  _  node.addAttribute("ui.label", node.getId());
      _ }

    }

}

This program_opens separate windows for both jframe and graph. I want to_show my graph into my JFrame or JPanel._Any idea about how to do this?_I have seen this_link,_but it doesn't explains me well.

A:

As shown_in_Graph_Visualization:_Advanced view: Integrating_the viewer in_your GUI, "you_will need_to create the_viewer by_yourself." Also, call_setVisible()_after you have constructed the frame.

It shows error on frame.add(view).

