I have a JavaFX 8 application...
MainApp.java
Parent root;
root = FXMLLoader.load(getClass().getResource("/fxml/MainForm.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
The MainForm.fxml
defines its controller with fx:controller="MainController"
and the controller itself contains a text field textFieldUsername
.
@FXML
protected TextField textFieldUsername;
Then, there is a second form AuxForm.fxml
with another controller fx:controller="AuxController"
. This second form is included in the MainForm.fxml
like this:
<content>
<fx:include source="AuxForm.fxml" />
</content>
Now I need to get the value of textFieldUsername
. This value is needed in the second controller but I have no idea how to do this. My first idea was public class AuxController extends MainController
to have all controls available but this doesn't work.