Define Custom Behavior in FXML with FXMLLoader

Published September 2017.

In the first article in this series, I discussed the basics of the FXML format and a handy utility named FXMLLoader, which, as the name implies, reads an FXML resource, parses its con- tents, and constructs a SceneGraph based on the definitions found in the FXML file. However, FXMLLoader can do more than just that, especially when it is combined with a common technique of modern Java development: dependency injection (DI). If you’re not familiar with FXMLLoader, it might be diicult to follow this article without first reading the earlier article.

The designers of the FXML format recognized that developers would like to tweak some settings using a programmatic approach, such as inserting a dynamic set of items to a ListView or a TableView right after the UI has been created but before the user has any chance to inter- act with the application.

Continue reading the rest of the article at the Oracle Java Magazine.

ˆ Back To Top