本文整理汇总了Java中javafx.scene.control.Dialog.setDialogPane方法的典型用法代码示例。如果您正苦于以下问题:Java Dialog.setDialogPane方法的具体用法?Java Dialog.setDialogPane怎么用?Java Dialog.setDialogPane使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Dialog
的用法示例。
在下文中一共展示了Dialog.setDialogPane方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
/**
* Create the dialog for choosing courses.
*
* @param courseList the list of courses to show in the dialog (let the user pick from them)
* @return the controller of the dialog window, enabling to display the dialog and read the selected result
*/
public ChooseCourseController create(List<Course> courseList) {
FXMLLoader fxmlLoader = this.fxmlLoader.get();
DialogPane dialogPane = null;
try (InputStream is = getClass().getResourceAsStream("ChooseCourseDialogPane.fxml")) {
dialogPane = fxmlLoader.load(is);
} catch (IOException e) {
AlertCreator.handleLoadLayoutError(fxmlLoader.getResources(), e);
}
ChooseCourseController chooseCourseController = fxmlLoader.getController();
chooseCourseController.setCourseList(courseList);
Dialog<ButtonType> dialog = new Dialog<>();
dialog.setDialogPane(dialogPane);
chooseCourseController.setDialog(dialog);
dialog.setTitle("StudyGuide");
return chooseCourseController;
}
示例2: create
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
/**
* Create the dialog for entering a String.
*
* @param prompt the string message to prompt the user with
* @return the controller of the dialog window, enabling to display the dialog and read the selected result
*/
public EnterStringController create(String prompt) {
FXMLLoader fxmlLoader = this.fxmlLoader.get();
DialogPane dialogPane = null;
try (InputStream is = getClass().getResourceAsStream("EnterStringDialogPane.fxml")) {
dialogPane = fxmlLoader.load(is);
} catch (IOException e) {
AlertCreator.handleLoadLayoutError(fxmlLoader.getResources(), e);
}
dialogPane.setHeaderText(prompt);
EnterStringController enterStringController = fxmlLoader.getController();
Dialog<ButtonType> dialog = new Dialog<>();
dialog.initModality(Modality.APPLICATION_MODAL);
dialog.setDialogPane(dialogPane);
enterStringController.setDialog(dialog);
dialog.setTitle("StudyGuide");
dialog.setOnShown(event -> enterStringController.getTextField().requestFocus());
return enterStringController;
}
示例3: show
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
static void show(Window window) {
try {
Pair<OptionsController, DialogPane> pair = Util.renderFxml(OptionsController.class);
Dialog<Void> dialog = new Dialog<>();
dialog.initOwner(window);
dialog.setDialogPane(pair.getValue());
dialog.show();
} catch (IOException e) {
e.printStackTrace();
}
}
示例4: openAboutDialog
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
private void openAboutDialog(ActionEvent actionEvent) {
Dialog dialog = new Dialog();
AboutDialogPane pane = new AboutDialogPane();
dialog.setTitle("About");
dialog.setDialogPane(pane);
dialog.showAndWait();
}