如何通过javafx实现以新窗口形式打开界面的长尾?

2026-04-15 10:1012阅读0评论SEO基础
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计163个文字,预计阅读时间需要1分钟。

如何通过javafx实现以新窗口形式打开界面的长尾?

打开指定人员详情编辑对话框。若用户点击确定,则更改保存至提供的人员对象,并返回true。

如何通过javafx实现以新窗口形式打开界面的长尾?

gistfile1.txt

// opens a dialog to edit details for the specified person. If the user // clicks OK, the changes are saved into the provided person object and true // is returned. public boolean showPersonEditDialog(Person person) { FXMLLoader loader = new FXMLLoader(); loader.setLocation(MainApp.class.getResource("view/PersonEditDialog.fxml")); try { AnchorPane page = (AnchorPane) loader.load(); // Create the dialog Stage. Stage dialogStage = new Stage(); dialogStage.setTitle("Edit Person"); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(primaryStage); Scene scene = new Scene(page); dialogStage.setScene(scene); // set the person into the controller PersonEditDialogController controller = loader.getController(); controller.setDialogStage(dialogStage); controller.setPerson(person); // show the dialog and wait until the user closes it dialogStage.showAndWait(); return controller.isOkClicked(); } catch (IOException e) { e.printStackTrace(); return false; } }

本文共计163个文字,预计阅读时间需要1分钟。

如何通过javafx实现以新窗口形式打开界面的长尾?

打开指定人员详情编辑对话框。若用户点击确定,则更改保存至提供的人员对象,并返回true。

如何通过javafx实现以新窗口形式打开界面的长尾?

gistfile1.txt

// opens a dialog to edit details for the specified person. If the user // clicks OK, the changes are saved into the provided person object and true // is returned. public boolean showPersonEditDialog(Person person) { FXMLLoader loader = new FXMLLoader(); loader.setLocation(MainApp.class.getResource("view/PersonEditDialog.fxml")); try { AnchorPane page = (AnchorPane) loader.load(); // Create the dialog Stage. Stage dialogStage = new Stage(); dialogStage.setTitle("Edit Person"); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(primaryStage); Scene scene = new Scene(page); dialogStage.setScene(scene); // set the person into the controller PersonEditDialogController controller = loader.getController(); controller.setDialogStage(dialogStage); controller.setPerson(person); // show the dialog and wait until the user closes it dialogStage.showAndWait(); return controller.isOkClicked(); } catch (IOException e) { e.printStackTrace(); return false; } }