Java Magazine, September/October 2017
learn more ORACLE COM JAVAMAGAZINE SEPTEMBER OCTOBER 2017 62 javafx the application grows in complexity and features you will quickly realize that this decision does not scale well Thus I highly recommend you think in terms of the MVC pattern and its variants and therefore place behavior in the controller only leaving data and state to a model class Instances of this class may be created manually or via a DI container its up to you to decide given the particular application requirements Conclusion FXML provides a declarative way to define JavaFX UIs but it cant be used to define behavior A controller can be specified to provide the required behavior Controllers can participate in DI in order to reach the UI components they need to configure Controllers can also define event handlers that can be hooked directly into UI components using a special format in the FXML file FXMLLoader is capable of instantiating controllers using a default strategy however this strategy can be changed if a diferent instantiation mechanism is needed article Andrés Almiray is a Java and Groovy developer and a Java Champion with more than 17 years of experience in software design and development He has been involved in web and desktop application development since the early days of Java He is a true believer in open source and has participated in popular projects such as Groovy JMatter Asciidoctor and others Hes a founding member and current project lead of the Griffon framework and he is the specification lead for JSR 377 DO YOU LIKE THIS NEW SINGLE COLUMN FORMAT FOR ARTICLES LET US KNOW AT JAVAMAG_ US@ ORACLE COM Oracles tutorial on FXML
You must have JavaScript enabled to view digital editions.