import javafx.event.ActionEvent; import javafx.fxml.FXML; public class MainController { @FXML void onClickButton(ActionEvent event) { App.setRoot("secondScene"); } }