V
V
Verg1l2015-02-21 19:01:55
Java
Verg1l, 2015-02-21 19:01:55

How to link two running controllers in Java (JavaFX)?

408c5951503f4b6da611cf571d1fa4e8.bmp
In general, we have two controllers and two fxml files.
Algorithm:
- We refer to the first file ( 1.fxml ) with the fxml extension (fill two text fields with data);
- When you click on the button - with the action of calling the method (onAction) in a specific controller, the second file ( 1.fxml ) fxml is called - which is also attached to the controller;
- When you click on the action button (see above), the text fields in the first .fxml file should be read ...
Question: - How to read this information (see the algorithm above)?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yuri Vitkovsky, 2015-02-22
@Verg1l

You can manually create both controllers, pass a link to the second to one of them, and then point them to the FXMLLoader via the setControler() method by calling it before calling the load() method

H
Hello America, 2015-02-21
@websofter

All actions with the form take place inside its controller, to get data from one controller in another, use fields to store data and use these fields in another controller by calling the controller class and that's it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question