Everything is ok until I try to visualize the java fx scene:
// create a flow object
VFlow flow = FlowFactory.newFlow();
// add two nodes to the flow
VNode n1 = flow.newNode();
VNode n2 = flow.newNode();
// create input and output connectors of type "default-type"
Connector inN1 = n1.addInput("default-type");
Connector outN1 = n1.addOutput("default-type");
Connector inN2 = n2.addInput("default-type");
Connector outN2 = n2.addOutput("default-type");
// create a connections
flow.connect(outN1, inN2);
// we assume a flow already exists
// make the flow visible
flow.setVisible(true);
// create a zoomable canvas
VCanvas canvas = new VCanvas();
Pane root = (Pane) canvas.getContent();
// creating a skin factory and attach it to the flow
FXSkinFactory skinFactory = new FXSkinFactory(root);
flow.setSkinFactories(skinFactory);
Scene scene = new Scene(canvas);
primaryStage.setTitle("Try");
primaryStage.setScene(scene);
primaryStage.show();// create a flow object
VFlow flow = FlowFactory.newFlow();
// add two nodes to the flow
VNode n1 = flow.newNode();
VNode n2 = flow.newNode();
// create input and output connectors of type "default-type"
Connector inN1 = n1.addInput("default-type");
Connector outN1 = n1.addOutput("default-type");
Connector inN2 = n2.addInput("default-type");
Connector outN2 = n2.addOutput("default-type");
// create a connections
flow.connect(outN1, inN2);
// we assume a flow already exists
// make the flow visible
flow.setVisible(true);
// create a zoomable canvas
VCanvas canvas = new VCanvas();
Pane root = (Pane) canvas.getContent();
// creating a skin factory and attach it to the flow
FXSkinFactory skinFactory = new FXSkinFactory(root);
flow.setSkinFactories(skinFactory);
Scene scene = new Scene(canvas);
primaryStage.setTitle("Try");
primaryStage.setScene(scene);
primaryStage.show();
I get the following error:
Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$154(LauncherImpl.java:182)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
at jfxtras.scene.control.window.Window.getUserAgentStylesheet(Window.java:501)
at com.sun.javafx.css.StyleManager.findMatchingStyles(StyleManager.java:1683)
at javafx.scene.CssStyleHelper.createStyleHelper(CssStyleHelper.java:111)
at javafx.scene.Node.reapplyCss(Node.java:8985)
at javafx.scene.Node.reapplyCss(Node.java:9014)
at javafx.scene.Node.reapplyCss(Node.java:9014)
at javafx.scene.Node.impl_reapplyCSS(Node.java:8948)
at javafx.scene.Node.invalidatedScenes(Node.java:856)
at javafx.scene.Node.setScenes(Node.java:921)
at javafx.scene.Scene$9.invalidated(Scene.java:1119)
at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:111)
at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:146)
at javafx.scene.Scene.setRoot(Scene.java:1072)
at javafx.scene.Scene.<init>(Scene.java:347)
at javafx.scene.Scene.<init>(Scene.java:194)
at sample.Main.start(Main.java:109)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$161(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
... 1 more
Exception running application sample.Main
Everything is ok until I try to visualize the java fx scene:
I get the following error:
which is triggered by the
new Scene(canvas)
linedid this happen to anybody else?