I have two screens which will be loaded at the start of program. I have a text field and a button on screen 1 and a label on screen2.
Now when I enter any text in text field of screen1 and and press the button, the label on screen2 should be set to that text (which was entered in screen1). (both the screens are active all the time right from program launch, so we need to update the label after the FXML is loaded).
I have tried properties and binding but had no success.
Controller 1: (Mapped to Controller1.fxml)
public class Controller1 {
@FXML private Button button;
@FXML private TextField tfield;
}
Controller 2: (Mapped to Controller2.fxml)
public class Controller2 {
@FXML private Label label;
}
Both the stages/screens are created from MainDriver.java class.