This question already has an answer here:
- Passing Parameters JavaFX FXML 10 answers
i am new to javafx and i want to transfer variable values
from one controller to another and i have no idea how to do this. so please help me.
for example:
i want to display username from first login window
to second dashboard window
so what should i do to save userid in one variable and send it to second window and display there in a label
.
code test:
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.layout.AnchorPane;
/**
* FXML Controller class
*
* @author wabcon
*/
public class AdmissionController implements Initializable {
int userid=0;
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
userid=10001;
}
}
how could i send this userid
to next window controller.
please help me.
Thank you.