How to get data in one Java FXML Controller from another FXML Controller (these controllers are not nested controllers)? [duplicate]
问题 This question already has an answer here : How can I use a variable from another Controller in JavaFX (1 answer) Closed 6 years ago . I have one button in one FXML and two text fields in another FXML. These two FXMLs are independent, I mean they are not nested. I want to print the text (which are in the two text fields) in the console/output whenever there is a click in the button. Below are the fxmls and their controllers: Button.fxml <AnchorPane id="AnchorPane" prefHeight="200.0" prefWidth=