Nerdkid posted an update 3 months, 1 week ago
Okay I have been learning java and using scenebuilder and I thought I should write this down because it is important and I might forget it, plus it might help others…as there really isn’t any explanation about this anywhere online (oracles documentation is very ambiguous and not very good for newbies like me).
When you are building applications in scenebuilder you maybe tempted to put all your on action methods in one controller but this is not a good way of doing things if you want to make a polymorphic/object orientated program which you can edit and expand quickly and easily.
That is why it is a good idea to use multiple controller classes and different multiple/nested controller classes when programming. Scenebuilder is good but it has lots of bugs and the way it is meant to work doesn’t actually work. For example in scenebuilder you create a main fxml file that have their own controllers assigned to them and then new ones and then you include these onto your main scene through file>include however for some reason scenebuilder doesn’t include anything when you do that. The way to include/nest extra fxmls is to go into your IDE (I use Intellij)and edit the FXML directly. For example if you have a tab pane in-between one of your tab sections you can have this piece of code fx:include source=”Mynewscene.fxml”. In scenebuilder you should make sure that your new scene has its own controller and your new fxml scene points to it. You might also need to assign the first container pane in your new scene with a fx:id which you can then reference to later just to be on the safe side.
This took me forever to work out and a heck of a lot of stress..but I got there eventually!