I try to integrate an unfoldingmaps in JavaFx.
To do so, I use the SimpleMapApp example.
But I have either a blank screen or an exception (Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Width (0) and height (0) cannot be <= 0).
Here is the example:
public class JavaFxIntegration extends Application {
/** {@inheritDoc} */
@Override
public void start (Stage stage) {
final SwingNode swingNode = new SwingNode();
createSwingContent(swingNode);
StackPane pane = new StackPane();
pane.getChildren().add(swingNode);
stage.setTitle("Unfoldingmaps in JavaFX");
stage.setScene(new Scene(pane, 800, 600));
stage.show();
}
/**
* Integrate the unfoldingmaps in the swingNode.
* @param swingNode parent node of the map.
*/
private void createSwingContent(SwingNode swingNode) {
SwingUtilities.invokeLater(() -> {
SimpleMapApp map = new SimpleMapApp();
map.init();
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add(map, BorderLayout.CENTER);
panel.setPreferredSize(new Dimension(800, 600));
panel.setBounds(0, 0, 800, 600);
swingNode.setContent(panel);
});
}
}
I try to integrate an unfoldingmaps in JavaFx. To do so, I use the SimpleMapApp example. But I have either a blank screen or an exception (Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Width (0) and height (0) cannot be <= 0).
Here is the example: