JavaFX - getScene() returns null
问题 I just started using JavaFX Scene Builder to build a small application. It is made up of a controller class 'Login.java' which belongs to 'login.fxml', in which the FXML file 'registrierung.fxml' is loaded via a method called 'registrationClicked(ActionEvent event)': public class Login { @FXML private void registrationClicked(ActionEvent event){ try{ ((Node) (event.getSource())).getScene().getWindow().hide(); FXMLLoader loader = new FXMLLoader(getClass().getResource("/view/fxml/registrierung