I am trying to implement a pop upp notification in JavaFx I am using this lib and according to that tutorial wrote this code:
String title = "Well done boy!!";
String message = "You've successfully created your first Tray Notification";
TrayNotification tray = new TrayNotification();
tray.setTitle(title);
tray.setMessage(message);
tray.setNotificationType(NotificationType.SUCCESS);
tray.showAndWait();
but the code is throwing an Exception:
Caused by: java.lang.IllegalStateException: Toolkit not initialized at com.sun.javafx.application.PlatformImpl.runLater(Unknown Source) at com.sun.javafx.application.PlatformImpl.runLater(Unknown Source) at com.sun.javafx.application.PlatformImpl.setPlatformUserAgentStylesheet(Unknown Source) at com.sun.javafx.application.PlatformImpl.setDefaultPlatformUserAgentStylesheet(Unknown Source) at javafx.scene.control.Control.(Unknown Source) ... 15 more
Any suggetion why?
please note, the original code example is implemented like:
tray.setNotification(notification);
where notification is
but some how I can not import the class
Notification notification = Notifications.SUCCESS;