Commit 5a5fafd3 authored by Thibaut Démare's avatar Thibaut Démare

Add a java program which listen event and build the corresponding graph

parent 5a042684
package org.graphstream.gama.tests;
import org.graphstream.stream.netstream.NetStreamReceiver;
import org.graphstream.ui.swingViewer.Viewer;
public class SimpleNetStreamViewer extends Viewer {
public SimpleNetStreamViewer(NetStreamReceiver receiver) {
this(receiver, true);
}
public SimpleNetStreamViewer(NetStreamReceiver receiver, boolean autoLayout) {
super(receiver.getDefaultStream());
addDefaultView(true);
if (autoLayout)
enableAutoLayout();
}
public SimpleNetStreamViewer(NetStreamReceiver receiver, boolean autoLayout, int width, int height) {
this(receiver, autoLayout);
getDefaultView().resizeFrame(width, height);
}
}
\ No newline at end of file
package org.graphstream.gama.tests;
import java.io.IOException;
import java.net.UnknownHostException;
import org.graphstream.stream.netstream.NetStreamReceiver;
public class Tests {
public static void main(String[] args) throws UnknownHostException, IOException {
// System.setProperty("gs.ui.renderer", "org.graphstream.ui.j2dviewer.J2DGraphRenderer");
// test graph viewer
new SimpleNetStreamViewer(new NetStreamReceiver(2000), true, 500, 500);
// test graph viewer
new SimpleNetStreamViewer(new NetStreamReceiver(2001), true, 500, 500);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment