How can I pass parameters to a secondary window in javafx? Is there a way to communicate with the corresponding controller?
For example:
The user chooses a customer from a TableView
and a new window is opened, showing the customer’s info.
Stage newStage = new Stage();
try
{
AnchorPane page = (AnchorPane) FXMLLoader.load(HectorGestion.class.getResource(fxmlResource));
Scene scene = new Scene(page);
newStage.setScene(scene);
newStage.setTitle(windowTitle);
newStage.setResizable(isResizable);
if(showRightAway)
{
newStage.show();
}
}
newStage
would be the new window. The problem is, I can’t find a way to tell the controller where to look for the customer’s info (by passing the id as parameter).
Any ideas?