在我的代码中,我可以使用以下按钮切换到另一个场景:
xor rdx,rdx
xor rsi,rsi
现在我在控制器类中有一个方法,该方法应该打开一个没有事件的场景:
public void handleButtonClick(MouseEvent event) throws IOException {
Parent menu_parent = FXMLLoader.load(getclass().getResource("/FXML/FXMLmm2.fxml"));
Scene SceneMenu = new Scene(menu_parent);
Stage stage = (Stage) ((Node) event.getsource()).getScene().getWindow();
stage.setScene(SceneMenu);
stage.show();
}
问题是,我不知道如何获取舞台节点,该程序仅在我打开一个全新的舞台/窗口时才起作用。
如何在没有事件的情况下切换到新场景并打开新舞台?