- From: Yoann Pigné <yoann.pigne AT gmail.com>
- To: "graphstream-users AT litislab.fr" <graphstream-users AT litislab.fr>, imran AT elogic.pk
- Subject: Re: Jframe issue
- Date: Fri, 9 Jun 2017 13:47:20 +0200
Hi,
I guess you forgot to activate the layout algorithm :
viewer.enableAutoLayout();
Regards,
Yoann
>
Le 9 juin 2017 à 12:02,
>
imran AT elogic.pk
>
a écrit :
>
>
Dear List,
>
>
Just trying out how to draw the graphs in a Swing component, e.g JFrame.
>
The graph does appear but the extent is not correct unlike when we use the
>
default viewer of GS Stream. The graph appears to be zoomed out such
>
extreme level that all nodes appear as one node.
>
>
Below is my code
>
>
Graph graph = new SingleGraph("Tutorial 1");
>
>
//Graph graph = new MultiGraph("embedded");
>
>
>
System.setProperty("org.graphstream.ui.renderer",
>
"org.graphstream.ui.j2dviewer.J2DGraphRenderer");
>
>
>
>
Viewer viewer = new Viewer(graph,
>
Viewer.ThreadingModel.GRAPH_IN_ANOTHER_THREAD);
>
View view = viewer.addDefaultView(false);
>
JFrame mainJFrame = new JFrame("test");
>
mainJFrame.setSize(800, 600);
>
mainJFrame.add((JPanel)view);
>
mainJFrame.setVisible(true);
>
>
mainJFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>
>
graph.addNode("A");
>
graph.addNode("B");
>
graph.addNode("C");
>
>
graph.addEdge("AB", "A", "B");
>
graph.addEdge("BC", "B", "C");
>
graph.addEdge("CA", "C", "A");
>
>
I am using version 1.3 and JDK 1.8. Have I done anything wrong?
>
>
Regards,
>
Imran
>
>
Sent from Mail for Windows 10
- Jframe issue, imran, 09/06/2017
- <Suite(s) possible(s)>
- Re: Jframe issue, Yoann Pigné, 09/06/2017
Archives gérées par MHonArc 2.6.16.