Instantiate an FXMLLoader and use an instance load method rather than a class static load method. You can then retrieve the controller instance from the loader instance.
FXMLLoader loader = new FXMLLoader(
getClass().getResource(
"customerDialog.fxml"
)
);
Pane pane = (Pane) loader.load();
CustomerDialogController controller =
loader.<CustomerDialogController>getController();
controller.initData(customer);
For more info see:
- Passing Parameters JavaFX FXML