Double skin addition
    Randahl Fink Isaksen 
    randahl at rockit.dk
       
    Wed Jun 11 07:57:51 UTC 2014
    
    
  
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
    
    
More information about the openjfx-dev
mailing list