本文整理匯總了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();
}