Hello Netbeans Users,
currently playing around with JavaFX FXML files and automatic controller
generation in Netbeans. This works quite good (simply clicking "Make
Controller" in the context menu of the FXML file).
However, I'm ecountering a problem when using nested/included FXML files and
thus nested controllers. The general approach doing this is the one described
here:
http://blog.buildpath.de/fxml-composition-how-to-get-the-controller-of-an-included-fxml-view-nested-controllers/
This works, but everytime I regenerate the controller using Netbeans' "Make
Controller" function, my custom @FXML annotated lines get wiped (or at least
the annotation). Also mentioned in the following Stackoverflow answer:
https://stackoverflow.com/a/24387797
This can be quite annoying in a scenario where you include multiple FXML
files (each with it's respective controller) and want the controllers to be
injected in your main controller class like so:
@FXML
private SubController1 includedFile1Controller;
@FXML
private SubController2 includedFile2Controller;
[...]
but after "Make Controller" it looks like this:
private SubController1 includedFile1Controller;
private SubController2 includedFile2Controller;
because Netbeans does not recognize these fields as fx:id's anywhere in the
FXML file. I believe this is related to the behavior of Netbeans to also not
generate @FXML annoted fields for fx:include elements in the FXML file like so:
<fx:include source="MyFile.fxml" fx:id="includedFile" />
That means the controller fields null due to not being injected and you'll
have to edit the lines manually, usually after encountering NPEs when running
your app :/
So my question is if there's a way to configure this function of Netbeans? Or
anything else I could do to help getting this bug fixed?
Thanks in advance for any help.
Cheers
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
For additional commands, e-mail: users-h...@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists