NPE in VirtualFlow
Hi! Every now and then I get the exception down there (starting with JavaFX 8u40-b18 if I remember correctly) It seems it has something to to with the fact that the items list of one of my TableViews gets cleared and so no cells are visible any more. I was not yet able to always reproduce that. I will try to do that, but probably someone has a clue anyway? BR, Mario java.lang.NullPointerException at com.sun.javafx.scene.control.skin.VirtualFlow.getCellIndex(VirtualFlow.java:1726) at com.sun.javafx.scene.control.skin.VirtualFlow.addLeadingCells(VirtualFlow.java:1274) at com.sun.javafx.scene.control.skin.VirtualFlow.layoutChildren(VirtualFlow.java:1194) at com.sun.javafx.scene.control.skin.VirtualFlow.setCellCount(VirtualFlow.java:231) at com.sun.javafx.scene.control.skin.TableViewSkinBase.updateRowCount(TableViewSkinBase.java:554) at com.sun.javafx.scene.control.skin.VirtualContainerBase.checkState(VirtualContainerBase.java:113) at com.sun.javafx.scene.control.skin.VirtualContainerBase.layoutChildren(VirtualContainerBase.java:108) at com.sun.javafx.scene.control.skin.TableViewSkinBase.layoutChildren(TableViewSkinBase.java:683) at javafx.scene.control.Control.layoutChildren(Control.java:576) at javafx.scene.Parent.layout(Parent.java:1076) at javafx.scene.Parent.layout(Parent.java:1082) at javafx.scene.Parent.layout(Parent.java:1082) at javafx.scene.Parent.layout(Parent.java:1082) at javafx.scene.Parent.layout(Parent.java:1082) at javafx.scene.Parent.layout(Parent.java:1082) at javafx.scene.Parent.layout(Parent.java:1082) at javafx.scene.Parent.layout(Parent.java:1082) at javafx.scene.Parent.layout(Parent.java:1082) at javafx.scene.Parent.layout(Parent.java:1082) 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$30(Toolkit.java:314) at com.sun.javafx.tk.Toolkit$$Lambda$243/122134773.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:313) at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:340) at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:525) at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:505) at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$400(QuantumToolkit.java:334) at com.sun.javafx.tk.quantum.QuantumToolkit$$Lambda$41/2090707712.run(Unknown Source) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
Re: switching skins at runtime
Hm, I've got it working, but I need to call a getChildren().clear() before I start creating nodes in a skin. If not, the control will retain the nodes an old skin has created. Also any style classes that were assigned remain, but those can be reset easily. Never the less I feel that setSkin() should clear the children and reset the style classes itself? Tom On 23-12-2014 15:39, Tom Eugelink wrote: Then this NPE on getSkinnable() when switching Agenda's skin when the control is already shown (instead of when created) must be my doing some how. Thanks! Tom On 23-12-2014 14:36, David Grieve wrote: Yes, it is allowed. But know that there is some code in setSkin that prevents setting a skin that is either instance equal or the same class. On 12/23/14, 6:27 AM, Tom Eugelink wrote: Is it allowed / supported to execute setSkin with a new skin on a control that is part of a scene? Tom