Writing a UI controller in JavaFX