Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/355.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
FXML控制器中的javafx how controlfx对话框_Java_Javafx_Javafx 8_Javafx 2_Controlsfx - Fatal编程技术网

FXML控制器中的javafx how controlfx对话框

FXML控制器中的javafx how controlfx对话框,java,javafx,javafx-8,javafx-2,controlsfx,Java,Javafx,Javafx 8,Javafx 2,Controlsfx,我如何在fxml控制器中打开对话框,因为它需要stage Dialogs.create() .owner(---what should i write here---) .title("Information Dialog") .masthead("Look, an Information Dialog") .message("I have a great message for you!") .showInformation(); 我添加了以下jar

我如何在fxml控制器中打开对话框,因为它需要
stage

 Dialogs.create()
    .owner(---what should i write here---)
    .title("Information Dialog")
    .masthead("Look, an Information Dialog")
    .message("I have a great message for you!")
    .showInformation();
我添加了以下jar

controlsfx-8.0.6_20.jar
controlsfx-samples-8.0.6_20.jar
fxsampler-1.0.6_20.jar

请帮帮我。

所有者是对话框窗口将使用的舞台:

import org.controlsfx.dialog.Dialogs;
import javafx.application.Application;
import javafx.stage.Stage;

public class Diag extends Application{

    @Override
    public void start(Stage primaryStage) throws Exception {
        Dialogs.create()
        .owner(primaryStage)
        .title("Information Dialog")
        .masthead("Look, an Information Dialog")
        .message("I have a great message for you!")
        .showInformation();
    }
    public static void main(String[] args) {
        launch(args);
    }

}
您可以将其称为对话框,也可以将其称为:

        Dialogs.create()
        .owner(new Stage())
        .title("Information Dialog")
        .masthead("Look, an Information Dialog")
        .message("I have a great message for you!")
        .showInformation();