我正在用javafx scenebuilder制作3个场景。
Scene A: Edit Record -> Scene C
Scene B: View Record -> Scene C
Scene C: View Data
如何在不创建重复场景C的情况下返回上一个场景(A或B)。
public void view(ActionEvent event) throws IOException{
Parent mainpanelForm = FXMLLoader.load(getClass().getResource("Scene A or Scene B file location"));
Scene mainpanelUI = new Scene(mainpanelForm);
Stage mainpanel = (Stage) ((Node)event.getSource()).getScene().getWindow();
mainpanel.setScene(mainpanelUI);
mainpanel.centerOnScreen();
mainpanel.setMaximized(true);
mainpanel.show();
}