java - 弹出时在顶部打开另一个 fxml
问题描述
我目前使用此代码更改 JFX 程序中的场景:
public void addTaskFunction (ActionEvent event) throws IOException{
Parent addTaskParent = FXMLLoader.load(getClass().getResource("/LogIn/AddDataToTaskManager.fxml"));
Scene addTaskScene = new Scene(addTaskParent);
Stage appStage = (Stage) ((Node) event.getSource()).getScene().getWindow();
appStage.setScene(addTaskScene);
appStage.setResizable(true);
appStage.show();
}
使用此代码关闭前一阶段并在顶部打开一个新阶段。我怎样才能使它上一个阶段不会关闭并且这个AddDataToTaskMaager.fxml在TaskManager.fxml之上打开
谢谢
解决方案
我用@kai 的提示更改了代码
public void addTaskFunction (ActionEvent event) throws IOException{
Parent addTaskParent = FXMLLoader.load(getClass().getResource("/LogIn/AddDataToTaskManager.fxml"));
Scene addTaskScene = new Scene(addTaskParent);
Stage stage = new Stage();
stage.setTitle("Thank You");
stage.setScene(addTaskScene);
stage.show();
}
推荐阅读
- python - python .index() 和 .find() 之间的时间复杂度差异
- payment-gateway - 不同的提供商支付佣金
- vba - VBA + Pivot:在过滤器更改时运行脚本,但在枢轴启动刷新之前
- c# - 我可以从 ac# 9 记录的自动生成方法中隐藏敏感属性值吗?
- python - 从空格分隔的字符串创建 Pandas DataFrame
- time-complexity - 这些代码的时间和空间复杂度
- azure-devops - 如何在 azure devops 中知道分叉存储库的源存储库?
- php - Composer - 供应商文件夹内的供应商文件夹 - 找不到类
- javascript - 无法更新
- python - 不要在 models.py 上显示复选框类型布尔值