posted 4 years ago
Hey, welcome to the Ranch!
The issue causing the exception is that your Group contains "newBox" because of this line:
And you are also trying to add the group to newBox here:
In JavaFX, this sort of circular dependency is not allowed.
However even if you get this fixed, it doesn't look like the code in the m1 action really does anything. It creates a new VBox and Group, but doesn't end up doing anything with them, so you'll never see those items anywhere. I'd recommend not creating new elements, and rather have the elements exist immediately and hide them. Then in the m1 code, you can un-hide them.