Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when starting a new scene #70

Open
alessiapacca opened this issue Sep 7, 2021 · 0 comments
Open

Exception when starting a new scene #70

alessiapacca opened this issue Sep 7, 2021 · 0 comments

Comments

@alessiapacca
Copy link

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

which is triggered by the
new Scene(canvas)
line

did this happen to anybody else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant