JavaFX Scene Builder and fx: enable

I am wondering how it can be used fx:includein conjunction with JavaFX Scene Builder, therefore:

Imagine what I have BorderPane(file borderpane.fxml). In the central part I want to put Label, which, however, must be defined in a separate FXML file, for example. label.fxml.

The first problem is this . Since it label.fxmlwill be integrated into the container (BorderPane), it does not need it. However, does SceneBuilder only offer the ability to create layouts that are containers?

The second problem . I can create label.fxmlmanually and then adapt borderpane.fxmlmanually to enable label.fxml. Then I can load the borderpane.fxml file using SceneBuilder without any problems. However, when I now change the label text and select "Save", not label.fxml, but instead, borderpane.fxmlchanges as follows:

# borderpane.fxml  
<fx:include source="label.fxml" text="the new label text" />

The new label text should be written to label.fxml, and 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 logical / normal, so this practical use case, we hope, is somehow supported by SceneBuilder?

+5
2

, Scene Builder 2 , .

() : root node Pane. , Label

() : File > Include > FXML... FXML. . , node "" " ", .

, Scene Builder 2 fx:include.

+6

- FXML .

, Java-. borderpane.fxml #setCentre node, label.fxml borderpane.fxml , .

: FXML ? , , , .

+1

All Articles