При создании собственного класса JOptionPane в JavaFX

Привет, я делаю проект по управлению общим магазином, и мне нужны диалоги с информационными сообщениями. Как вы знаете, они не в javafx, а в Swing, поэтому для этой цели я сделал это диалоговое окно с файлом fxml. Вот код, который я сделал в этом классе

    package supportingframes;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.stage.Modality;
import javafx.stage.Stage;

public class ShowMessageDialog {
    @FXML Button okBtn; 
    @FXML Label messageLb;
    private Stage primaryStage;
    public ShowMessageDialog(String message, String title) {
        try {
            Parent root=FXMLLoader.load(getClass().getResource("/supportingframes/showInformationDialog.fxml"));
            Scene scene = new Scene(root);          
            scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
            primaryStage.setScene(scene);
            primaryStage.setTitle(title);
            messageLb.setText(message);
            primaryStage.setResizable(false);           
            primaryStage.show();
            primaryStage.initOwner(primaryStage);
            primaryStage.initModality(Modality.APPLICATION_MODAL);
            primaryStage.showAndWait();
            okBtn.setOnAction(new EventHandler<ActionEvent>() {

                @Override
                public void handle(ActionEvent event) {
                    primaryStage.close();
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}

Теперь после выполнения кода я получаю следующее исключение и кучу неизвестных

    javafx.fxml.LoadException: 
/D:/Personals/Documents/Books/Semester%203/Introduction%20to%20Software%20Engineering/Project%20Works/JavaFX/GeneralStoreManagement/bin/supportingframes/showInformationDialog.fxml:12

    at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
    at javafx.fxml.FXMLLoader.access$700(FXMLLoader.java:103)
    at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:932)
    at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:971)
    at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:220)
    at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:744)
    at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2707)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
    at application.Main.start(Main.java:26)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$161(LauncherImpl.java:863)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(PlatformImpl.java:326)
    at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.InstantiationException: supportingframes.ShowMessageDialog
    at java.lang.Class.newInstance(Unknown Source)
    at sun.reflect.misc.ReflectUtil.newInstance(Unknown Source)
    at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:927)
    ... 22 more
Caused by: java.lang.NoSuchMethodException: supportingframes.ShowMessageDialog.<init>()
    at java.lang.Class.getConstructor0(Unknown Source)
    ... 25 more

person Software Engineer    schedule 06.12.2018    source источник
comment
В вашем файле FXML есть проблема в строке 12. Но мы не можем помочь, не видя ее.   -  person Pagbo    schedule 06.12.2018
comment
Не связано : ваша кнопка «ОК» okBtn не будет реагировать должным образом, поскольку ее действие объявлено после showAndWait.   -  person Pagbo    schedule 06.12.2018