[jgrapht-users] jgrapht and swing
Brought to you by:
barak_naveh,
perfecthash
From: janani a. <jan...@gm...> - 2011-03-04 04:40:14
|
hi everyone, i am new to jgrapht n java.i need to develop a "graph creator" application as a part of the acadamics.i would like to create a stand alone java swing project using jgrapht.a part of the code is as shown.is this how i should add jgraph to JPanel(this code is not helping). ... JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel pane=new JPanel(); frame.setContentPane(pane); ListenableGraph<String , DefaultEdge> g = new ListenableDirectedMultigraph<String , DefaultEdge>( DefaultEdge.class); jgAdapter = new JGraphModelAdapter<String , DefaultEdge>(g); JGraph jgraph = new JGraph(jgAdapter); adjustDisplaySettings(jgraph); pane.add(jgraph); //add vertices and edges. frame.pack(); frame.setVisible(true); ... thank you, janani |