GraphStream Users

Archives de la liste Aide


RE: Jframe issue


Chronologique Discussions 
  • From: <imran AT elogic.pk>
  • To: Yoann Pigné <yoann.pigne AT gmail.com>, "graphstream-users AT litislab.fr" <graphstream-users AT litislab.fr>
  • Subject: RE: Jframe issue
  • Date: Sat, 10 Jun 2017 03:06:29 -0700
  • Importance: normal

Hello,

 

Thanks a lot, yes that fixed the issue. Maybe I missed that in documentation. Is it possible to look at the source code of video demonstrations?

 

Thanks

Imran

 

Sent from Mail for Windows 10

 

From: Yoann Pigné
Sent: Friday, June 9, 2017 4:48 AM
To: graphstream-users AT litislab.fr; imran AT elogic.pk
Subject: Re: Jframe issue

 

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

 

 




Archives gérées par MHonArc 2.6.16.

Top of page