Skip to content

Instantly share code, notes, and snippets.

@matheus1lva
Created August 13, 2016 17:44
Show Gist options
  • Save matheus1lva/3e7161484334d7becee1d56fc2c51d22 to your computer and use it in GitHub Desktop.
Save matheus1lva/3e7161484334d7becee1d56fc2c51d22 to your computer and use it in GitHub Desktop.
public static void main(String[] args) {
System.setProperty("org.graphstream.ui.renderer", "org.graphstream.ui.j2dviewer.J2DGraphRenderer");
Graph graph = new MultiGraph("main graph");
graph.addAttribute("ui.stylesheet", styleSheet);
SpriteManager sm = new SpriteManager(graph);
Node a = graph.addNode("A");
Node b = graph.addNode("B");
Node c = graph.addNode("C");
Edge AB = graph.addEdge("edge ab", a, b);
Edge CB = graph.addEdge("edge cb", c, b);
Edge AC = graph.addEdge("edge ac", a, c);
Sprite A = sm.addSprite("sprite a");
A.setPosition(0,0,0);
A.attachToNode("A");
Sprite B = sm.addSprite("sprite b");
B.setPosition(0,0,0);
B.attachToNode("B");
Sprite C = sm.addSprite("sprite c");
C.setPosition(0,0,0);
C.attachToNode("C");
Viewer viewer = graph.display();
}
protected static String styleSheet = "sprite {fill-color:red;}";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment