Saving user preferences

To allow our newly-defined user interface to be wired into our controller, we need to create instance variables to match the controls with the fx:id attributes set, so, we add these to PreferencesController as follows:

    @FXML 
    protected Button savePrefs; 
    @FXML 
    protected Button cancel; 
    @FXML 
    protected TabPane tabPane; 

In the initialize() method, we need to add support for loading the saved value for our itemCount field, so we need to talk a little bit about preferences.

Java, being the general-purpose language that it is, makes it possible to write any preference storing strategy that you can image. Fortunately, though, it also offers a couple of different standard APIs that allow you to do so in a more easily portable ...

Get Java 9: Building Robust Modular Applications now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.