Don't know if also other versions of JavaFX are involed (just started using this version)
In documentation and examples Group.getChildren().add(Node n) is used for adding nodes to a group.
getChildren() is protected and therefore canot be used in an applicatin directly.
getChildrenUnmodifiable() is public, but does not allow any add, since it is unmodifiable and gives
java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:148)
at java.util.AbstractList.add(AbstractList.java:108)
at de.cmk.jfx.Test2.start(Test2.java:47)
So what is the correct way to add nodes to a group and why there is still the example in the documentation that getChildren().add(Node) is the way?
In documentation and examples Group.getChildren().add(Node n) is used for adding nodes to a group.
getChildren() is protected and therefore canot be used in an applicatin directly.
getChildrenUnmodifiable() is public, but does not allow any add, since it is unmodifiable and gives
java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:148)
at java.util.AbstractList.add(AbstractList.java:108)
at de.cmk.jfx.Test2.start(Test2.java:47)
So what is the correct way to add nodes to a group and why there is still the example in the documentation that getChildren().add(Node) is the way?