Caused by: java.lang.IllegalArgumentException: Children: duplicate children added: parent = VBox[id=root]
at javafx.scene.Parent$3.onProposedChange(Parent.java:558)
at com.sun.javafx.collections.VetoableListDecorator.add(VetoableListDecorator.java:206)
at com.jfoenix.controls.JFXSnackbar.registerSnackbarContainer(JFXSnackbar.java:193)
I don't think we can do without calling registerSnackbarContainer as it also does a few other thing, so i guess the correct fix is to check if the snackbar is already a direct descendent of the root container before adding.
if (!this.snackbarContainer.getChildren().contains(this)) {
this.snackbarContainer.getChildren().add(this);
}
According to google, when I use
JFXSnackbar
it must be initialized with the root pane.I'm someone who prefers to write all UI based elements in fxml
this causes the following exception to be thrown
presumably due to this line of code
https://github.com/sshahine/JFoenix/blob/2dbb8515da236140c41eabe22eb549b458f1e867/jfoenix/src/main/java/com/jfoenix/controls/JFXSnackbar.java#L193
If I put the snackbar as a child of another node, it works
I don't think we can do without calling
registerSnackbarContainer
as it also does a few other thing, so i guess the correct fix is to check if the snackbar is already a direct descendent of the root container before adding.