Here is an example to create and use a custom component
test.fxml
<fx:root type="javafx.scene.layout.StackPane">
<children>
<Label text="Name" />
<TextField fx:id="nameTextField" />
</children>
</fx:root>
The Java Presenter
public class TestPane extends StackPane implements Initializable {
@FXML TextField nameTextField;
public Test() {
FxmlLoader.load(this.getClass().getResource("test.fxml"));
}
(...)
}
And I can use the new component TestPane
test-use.fxml
<fx:root type="javafx.scene.layout.StackPane">
(...)
<TestPane fx:id="myTestPane" />
(...)
</fx:root>