JavaFX Tutorial - Controllers

Veröffentlicht am: 13 Februar 2019
auf dem Kanal: Noble Code Monkeys
1,095
19

I’m a big advocate of the Model-View-Controller approach to user interface development. As I have mentioned previously, I prefer layout portion of our JavaFX code to be located in the FMXL file, with a supporting controller file that helps manage states and logic flow. As your GUI applications get larger, you will want to have more than one FXML and Controller pairing, and interaction will naturally need to flow among the different components.
The focus of this tutorial will be on how to gain access to the controller object in code. There are really 2 common use cases for this.
1) Access the controller of an FXML file you have loaded in code.
2) Access the controller of an FXML file you have loaded inside another fxml file.
You can find many examples on how to do the first, but there are still a few gotchas to be aware of. As for the second approach, I find it very useful in certain circumstances, but few people talk about it.
We'll be starting from the example we discussed in the Tab Pane tutorial, so if you aren't familiar with how to load FXML files, go check that tutorial out first.
   • JavaFX Tutorial - Tab Pane and nested FXML...  


Auf dieser Seite können Sie das Online-Video JavaFX Tutorial - Controllers mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Noble Code Monkeys 13 Februar 2019 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 1,095 Mal angesehen und es wurde von 19 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!