1

I'm trying to show a notification when a pane is first rendered. Here is the code for my controller initialize method.

 @Override
    public void initialize(URL location, ResourceBundle resources) {

        Notifications.create()
        .title("Title Text")
        .text("Hello World 0!")
        .showWarning();
}

The notification is not showing and the app quits, I'm getting the following trace:

  at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2579)
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
    at com.project.App.showMainView(App.java:325)
    at com.project.App.hideSplash(App.java:297)
    at com.project.App.access$1(App.java:295)
    at com.project.App$2.run(App.java:221)
    at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
Caused by: java.lang.NullPointerException
    at org.controlsfx.control.Notifications$NotificationPopupHandler.show(Notifications.java:334)
    at org.controlsfx.control.Notifications$NotificationPopupHandler.show(Notifications.java:322)
    at org.controlsfx.control.Notifications.show(Notifications.java:269)
    at org.controlsfx.control.Notifications.showWarning(Notifications.java:235)
    at com.project.controllers.admin.myController.initialize(myController.java:100)
Suemayah Eldursi
  • 969
  • 4
  • 14
  • 36

0 Answers0