What value will the controller take ?:

DialogController controller = loader.getController(); 
  • Well, if you don’t get killed by type narrowing, then DialogController - Maxim

1 answer 1

When you receive the controller via FXMLLoader you receive an object in which:

  • initialized fields marked with FXML annotation

  • when initializing all fields (specified above) the initialize method is called

  • Call the appropriate methods that handle the relevant events.

The last two points are not so important, since you do not do this manually. The main reason for getting the controller via FXMLLoader is the initialized fields.