Chapter 8 ■ JavaFX 9 SCene Graph hierarChy: a Foundation For Java 9 Game deSiGn
When you are finished, your new event-handling structures should look like the following Java code
shown in the middle of Figure 8-15:
gameButton.setOnAction(new EventHandler
@Override
public void handle(ActionEvent event) {
System.out.println("Starting Game");
}
});
helpButton.setOnAction(new EventHandler
@Override
public void handle(ActionEvent event) {
System.out.println("Game Instructions");
}
});
scoreButton.setOnAction(new EventHandler
@Override
public void handle(ActionEvent event) {
System.out.println("High Score");
}
});
legalButton.setOnAction(new EventHandler
@Override
public void handle(ActionEvent event) {
System.out.println("Copyrights");
}
});
Figure 8-14. Copy the gameButton event processing code and paste it underneath itself and create your
helpButton event handling