6

I get the following exception when running a simple program demonstrating the use of the TreeView control:

java.lang.RuntimeException: Error while creating node:class javafx.scene.layout.StackPane id:null

The error occurs when expanding or closing TreeItems with children.

Here is the SSCCE:

import static javafx.application.Application.launch;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import javafx.stage.Stage;
public class TreeViewTest extends Application {
    Tab treeTab;
    @Override
    public void start(Stage primaryStage) throws Exception {
        TabPane pane = new TabPane();
        Scene scene = new Scene(pane,800,600);
        treeTab = new Tab("Tree");
        pane.getTabs().addAll(treeTab);
        primaryStage.setTitle("F(X)yz - Collision Test");
        primaryStage.setScene(scene);
        primaryStage.show();
        makeTree();
    }
    private void makeTree(){
        TreeItem<String> treeItemRoot = new TreeItem<> ("Root");         
        TreeItem<String> nodeItemA = new TreeItem<>("Item A");
        TreeItem<String> nodeItemB = new TreeItem<>("Item B");
        TreeItem<String> nodeItemC = new TreeItem<>("Item C");
        treeItemRoot.getChildren().addAll(nodeItemA, nodeItemB, nodeItemC);        
        TreeItem<String> nodeItemCA = new TreeItem<>("Item CA");
        TreeItem<String> nodeItemCB = new TreeItem<>("Item CB");
        nodeItemC.getChildren().addAll(nodeItemCA, nodeItemCB);         
        TreeItem<String> nodeItemA1 = new TreeItem<>("Item A1");
        TreeItem<String> nodeItemA2 = new TreeItem<>("Item A2");
        TreeItem<String> nodeItemA3 = new TreeItem<>("Item A3");
        nodeItemA.getChildren().addAll(nodeItemA1, nodeItemA2, nodeItemA3);         
        TreeView<String> treeView = new TreeView<>(treeItemRoot);
        treeTab.setContent(treeView);        
    }        
     public static void main(String[] args) {
        launch(args);
    }
}

This is running on jdk1.8.0_162 in Netbeans 8.2 on WIndows 7.

Please can anyone suggest an improvement to get rid of the error. Thanks.

PS StackTrace:

java.lang.RuntimeException: Error while creating node:class javafx.scene.layout.StackPane id:null
NODE INFORMATION
Node:StackPane@5bb0a705[styleClass=tree-disclosure-node] Class:class javafx.scene.layout.StackPane Id:null
Children:[StackPane@401249ef[styleClass=arrow]]
PARENT INFORMATION
Node:TreeViewSkin$1@72fac9c9[styleClass=cell indexed-cell tree-cell]'Root' Class:class com.sun.javafx.scene.control.skin.TreeViewSkin$1 Id:null
Children:[Text[text="Root", x=0.0, y=0.0, alignment=LEFT, origin=BASELINE, boundsType=LOGICAL_VERTICAL_CENTER, font=Font[name=System Regular, family=System, style=Regular, size=15.0], fontSmoothingType=LCD, fill=0x333333ff]]

    at org.fxconnector.node.SVNodeFactory.createNode(SVNodeFactory.java:56)
    at org.fxconnector.StageControllerImpl.createNode(StageControllerImpl.java:775)
    at org.fxconnector.StageControllerImpl.lambda$new$10(StageControllerImpl.java:231)
    at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:329)
    at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73)
    at javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:233)
    at javafx.collections.FXCollections$UnmodifiableObservableListImpl.lambda$new$62(FXCollections.java:929)
    at javafx.collections.WeakListChangeListener.onChanged(WeakListChangeListener.java:88)
    at com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:164)
    at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73)
    at com.sun.javafx.collections.VetoableListDecorator.lambda$new$31(VetoableListDecorator.java:76)
    at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:329)
    at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73)
    at javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:233)
    at javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
    at javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
    at javafx.collections.ObservableListBase.endChange(ObservableListBase.java:205)
    at javafx.collections.ModifiableObservableListBase.remove(ModifiableObservableListBase.java:183)
    at com.sun.javafx.collections.VetoableListDecorator.remove(VetoableListDecorator.java:332)
    at com.sun.javafx.collections.VetoableListDecorator.remove(VetoableListDecorator.java:221)
    at javafx.scene.Parent.impl_toBack(Parent.java:644)
    at javafx.scene.Node.toBack(Node.java:1756)
    at com.sun.javafx.scene.control.skin.TreeCellSkin.updateDisclosureNode(TreeCellSkin.java:186)
    at com.sun.javafx.scene.control.skin.TreeCellSkin.layoutChildren(TreeCellSkin.java:211)
    at javafx.scene.control.Control.layoutChildren(Control.java:578)
    at javafx.scene.Parent.layout(Parent.java:1087)
    at javafx.scene.Parent.layout(Parent.java:1093)
    at javafx.scene.Parent.layout(Parent.java:1093)
    at javafx.scene.Parent.layout(Parent.java:1093)
    at javafx.scene.Parent.layout(Parent.java:1093)
    at javafx.scene.Parent.layout(Parent.java:1093)
    at javafx.scene.Parent.layout(Parent.java:1093)
    at javafx.scene.Scene.doLayoutPass(Scene.java:552)
    at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2397)
    at com.sun.javafx.tk.Toolkit.lambda$runPulse$29(Toolkit.java:398)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:397)
    at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:424)
    at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:518)
    at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:498)
    at com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:491)
    at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$403(QuantumToolkit.java:319)
    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)
    at java.lang.Thread.run(Thread.java:748)
java.lang.RuntimeException: Error while creating node:class javafx.scene.layout.StackPane id:null
NODE INFORMATION
Node:StackPane@3fb4f2e2[styleClass=tree-disclosure-node] Class:class javafx.scene.layout.StackPane Id:null
Children:[StackPane@b52262b[styleClass=arrow]]
PARENT INFORMATION
Node:TreeViewSkin$1@330b4596[styleClass=cell indexed-cell tree-cell]'Item A' Class:class com.sun.javafx.scene.control.skin.TreeViewSkin$1 Id:null
Children:[Text[text="", x=0.0, y=0.0, alignment=LEFT, origin=BASELINE, boundsType=LOGICAL_VERTICAL_CENTER, font=Font[name=System Regular, family=System, style=Regular, size=15.0], fontSmoothingType=LCD, fill=0x333333ff]]

    at org.fxconnector.node.SVNodeFactory.createNode(SVNodeFactory.java:56)
    at org.fxconnector.StageControllerImpl.createNode(StageControllerImpl.java:775)
    at org.fxconnector.StageControllerImpl.lambda$new$10(StageControllerImpl.java:231)
    at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:329)
    at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73)
    at javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:233)
    at javafx.collections.FXCollections$UnmodifiableObservableListImpl.lambda$new$62(FXCollections.java:929)
    at javafx.collections.WeakListChangeListener.onChanged(WeakListChangeListener.java:88)
    at com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:164)
    at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73)
    at com.sun.javafx.collections.VetoableListDecorator.lambda$new$31(VetoableListDecorator.java:76)
    at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:329)
    at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73)
    at javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:233)
    at javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
    at javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
    at javafx.collections.ObservableListBase.endChange(ObservableListBase.java:205)
    at javafx.collections.ModifiableObservableListBase.remove(ModifiableObservableListBase.java:183)
    at com.sun.javafx.collections.VetoableListDecorator.remove(VetoableListDecorator.java:332)
    at com.sun.javafx.collections.VetoableListDecorator.remove(VetoableListDecorator.java:221)
    at javafx.scene.Parent.impl_toBack(Parent.java:644)
    at javafx.scene.Node.toBack(Node.java:1756)
    at com.sun.javafx.scene.control.skin.TreeCellSkin.updateDisclosureNode(TreeCellSkin.java:186)
    at com.sun.javafx.scene.control.skin.TreeCellSkin.layoutChildren(TreeCellSkin.java:211)
    at javafx.scene.control.Control.layoutChildren(Control.java:578)
    at javafx.scene.Parent.layout(Parent.java:1087)
    at javafx.scene.Parent.layout(Parent.java:1093)
    at javafx.scene.Parent.layout(Parent.java:1093)
    at javafx.scene.Parent.layout(Parent.java:1093)
    at javafx.scene.Parent.layout(Parent.java:1093)
    at javafx.scene.Parent.layout(Parent.java:1093)
    at javafx.scene.Parent.layout(Parent.java:1093)
    at javafx.scene.Scene.doLayoutPass(Scene.java:552)
    at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2397)
    at com.sun.javafx.tk.Toolkit.lambda$runPulse$29(Toolkit.java:398)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:397)
    at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:424)
    at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:518)
    at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:498)
    at com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:491)
    at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$403(QuantumToolkit.java:319)
    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)
    at java.lang.Thread.run(Thread.java:748)
java.lang.RuntimeException: Error while creating node:class javafx.scene.layout.StackPane id:null
NODE INFORMATION
Node:StackPane@4a2a9995[styleClass=tree-disclosure-node] Class:class javafx.scene.layout.StackPane Id:null
Children:[StackPane@5483de69[styleClass=arrow]]
PARENT INFORMATION
Node:TreeViewSkin$1@269becf3[styleClass=cell indexed-cell tree-cell]'Item C' Class:class com.sun.javafx.scene.control.skin.TreeViewSkin$1 Id:null
Children:[Text[text="", x=0.0, y=0.0, alignment=LEFT, origin=BASELINE, boundsType=LOGICAL_VERTICAL_CENTER, font=Font[name=System Regular, family=System, style=Regular, size=15.0], fontSmoothingType=LCD, fill=0x333333ff]]

    at org.fxconnector.node.SVNodeFactory.createNode(SVNodeFactory.java:56)
    at org.fxconnector.StageControllerImpl.createNode(StageControllerImpl.java:775)
    at org.fxconnector.StageControllerImpl.lambda$new$10(StageControllerImpl.java:231)
    at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:329)
    at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73)
    at javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:233)
    at javafx.collections.FXCollections$UnmodifiableObservableListImpl.lambda$new$62(FXCollections.java:929)
    at javafx.collections.WeakListChangeListener.onChanged(WeakListChangeListener.java:88)
    at com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:164)
    at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73)
    at com.sun.javafx.collections.VetoableListDecorator.lambda$new$31(VetoableListDecorator.java:76)
    at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:329)
    at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:73)
    at javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:233)
    at javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
    at javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
    at javafx.collections.ObservableListBase.endChange(ObservableListBase.java:205)
    at javafx.collections.ModifiableObservableListBase.remove(ModifiableObservableListBase.java:183)
    at com.sun.javafx.collections.VetoableListDecorator.remove(VetoableListDecorator.java:332)
    at com.sun.javafx.collections.VetoableListDecorator.remove(VetoableListDecorator.java:221)
    at javafx.scene.Parent.impl_toBack(Parent.java:644)
    at javafx.scene.Node.toBack(Node.java:1756)
    at com.sun.javafx.scene.control.skin.TreeCellSkin.updateDisclosureNode(TreeCellSkin.java:186)
    at com.sun.javafx.scene.control.skin.TreeCellSkin.layoutChildren(TreeCellSkin.java:211)
    at javafx.scene.control.Control.layoutChildren(Control.java:578)
    at javafx.scene.Parent.layout(Parent.java:1087)
    at javafx.scene.Parent.layout(Parent.java:1093)
    at javafx.scene.Parent.layout(Parent.java:1093)
    at javafx.scene.Parent.layout(Parent.java:1093)
    at javafx.scene.Parent.layout(Parent.java:1093)
    at javafx.scene.Parent.layout(Parent.java:1093)
    at javafx.scene.Parent.layout(Parent.java:1093)
    at javafx.scene.Scene.doLayoutPass(Scene.java:552)
    at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2397)
    at com.sun.javafx.tk.Toolkit.lambda$runPulse$29(Toolkit.java:398)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:397)
    at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:424)
    at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:518)
    at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:498)
    at com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:491)
    at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$403(QuantumToolkit.java:319)
    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)
    at java.lang.Thread.run(Thread.java:748)
6
  • hmm ... worksform in 8_151 and 9_01 - would not expect an "intermediate" misbehaviour in 8_161. On the other hand: faintly remember having seen a weird bug around treeView recently, but can't find it ... could you please add the stacktrace? Commented Mar 16, 2018 at 10:04
  • 4
    That got me worried so I copied the file to a 'clean project - I still get the error when I run it. However, googling org.fxconnector.node.SVNodeFactory has led me to the ScenicView source code. I then remembered I had ScenicView running!!! Commented Mar 16, 2018 at 13:28
  • 1
    After the closing ScenicView the test program now works as expected. Thanks for your comment. I still think it is probably a bug as I don't think that ScenicView should cause a RuntimeException. Commented Mar 16, 2018 at 13:35
  • 1
    glad you found the reason :) Most probably a bug, I would suspect ScenicView to be the culprit ... Commented Mar 16, 2018 at 13:42
  • 1
    Just to confirm, had the exact same problem here. Running Javafx 11.0.2 under linux and also saw the stacktraces. I also had ScenicView running in the background. Closed it and the stacktrace is gone! :) thanks @jimbo8 for leading me to it :) Commented Mar 29, 2019 at 10:54

1 Answer 1

8

I encountered this as well so I'll put the @jimbo8's comment as the answer:

This is caused by ScenicView.

Close ScenicView and you won't get this error anymore.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.