如何在JavaFX 2.0中创建和显示通用对话框(错误,警告,确认)? [英] How to create and show common dialog (Error, Warning, Confirmation) in JavaFX 2.0?

查看:798
本文介绍了如何在JavaFX 2.0中创建和显示通用对话框(错误,警告,确认)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在JavaFX 2.0中创建和显示常用对话框(错误,警告,确认)?我找不到任何标准类,如 Dialog DialogBox Message 或某事。

How do I create and show common dialogs (Error, Warning, Confirmation) in JavaFX 2.0? I can't find any "standard" classes like Dialog, DialogBox, Message or something.

推荐答案

编辑:将对话框支持添加到JavaFX, http://stackoverflow.com/a/28887273/1054140

EDIT: dialog support was added to JavaFX, see http://stackoverflow.com/a/28887273/1054140

2011年没有一个常见的对话框支持。
您必须通过创建新的

There were no common dialog support in a year 2011. You had to write it yourself by creating new Stage():

    Stage dialogStage = new Stage();
    dialogStage.initModality(Modality.WINDOW_MODAL);

    VBox vbox = new VBox(new Text("Hi"), new Button("Ok."));
    vbox.setAlignment(Pos.CENTER);
    vbox.setPadding(new Insets(15));

    dialogStage.setScene(new Scene(vbox));
    dialogStage.show();

这篇关于如何在JavaFX 2.0中创建和显示通用对话框(错误,警告,确认)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆