I've been able to successfully embed a GraphStream View into a JavaFX GUI. Here is the key code:
Viewer viewer = new Viewer(network, ThreadingModel.GRAPH_IN_SWING_THREAD);
View view = viewer.addDefaultView(false);
viewer.enableAutoLayout();
viewer.setCloseFramePolicy(Viewer.CloseFramePolicy.EXIT);
SwingNode swingNode = new SwingNode();
swingNode.setContent(view);
StackPane pane = new StackPane();
pane.getChildren().add(swingNode);
This uses the newly available SwingNode (http://download.java.net/jdk8/jfxdocs/javafx/embed/swing/SwingNode.html) to embed Swing content into a JavaFX application.
While this works for me, it introduces an extra GUI thread (Swing and JavaFX). For example, dynamic changes to GraphStream graphs do not refresh in the GUI until the Swing thread completes and returns control to JavaFX.
I was wondering if there are plans for eventual support of support for JavaFX in GraphStream?
Steve
Archives gérées par MHonArc 2.6.16.