I am wondering how one can use fx:include
in conjunction with the JavaFX Scene Builder, therefore:
Imagine I have a BorderPane
(file borderpane.fxml
). In the center section I want to put a Label
which shall however be defined in a separate FXML file, e.g. label.fxml
.
First problem of this: As the label.fxml
will be integrated into a container (the BorderPane) it doesn't need one itself. The SceneBuilder however only offers the option to create layouts being a container?
Second problem: I can create the label.fxml
manually and then adapt borderpane.fxml
manually to include the label.fxml
. I then can load the borderpane.fxml file using SceneBuilder without any problems. However when I now change the text of the label and choose "Save", not the label.fxml
is modified, but instead the borderpane.fxml
is modified like this:
# borderpane.fxml
<fx:include source="label.fxml" text="the new label text" />
The new label text should be written to label.fxml
, not to borderpane.fxml
, what is currently done.
Am I doing something wrong?
Is SceneBuilder not intended to be used in conjunction with fx:include?
I want separate Controllers for parts of my GUI, I think this is quite logically/normal, so this practical usage scenario is hopefully somehow supported by the SceneBuilder?