I have noticed that if I create a skin which adds a label like this

        public MySkin(MyControl control) {
                super(control);
                pane.getChildren().add(label);
                getChildren().add(pane);
        }

the label is actually added twice in my application. I suspect this is because 
I am switching style sheets during startup, which means my createDefaultSkin 
method might be invoked twice.

I found out, I can easily solve this by changing my code to using a 
getChildren().setAll(label) rather than getChildren().add(label), but I am 
surprised that JavaFX would not by itself clear the control’s children when 
applying a new skin.

Has anyone else experienced this?

Thanks

Randahl

Reply via email to