Adding a refresh button

In the Projects window, find sunago.fxml, right-click on it, and select Edit. We'll make this user interface change by hand, only for the sake of experience. Scroll down until you find the closing Menubar tag (</Menubar>). On the line right after that, insert these lines:

    <ToolBar > 
      <items> 
        <Button fx:id="refreshButton" /> 
        <Button fx:id="settingsButton" /> 
      </items> 
    </ToolBar> 

In SunagoController, we need to add the instance variables as follows:

    @FXML 
    private Button refreshButton; 
    @FXML 
    private Button settingsButton; 

Then, in initialize(), we need to set them up like this:

 refreshButton.setGraphic(getButtonImage("/images/reload.png")); refreshButton.setOnAction(ae -> loadItemsFromNetworks()); refreshButton.setTooltip(new ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.