Apparently, javaFx Still does not provide a way to display notifications on the tray, but you can use a third-party library to achieve your goal.
Traynotification
String title = "Congratulations sir";
String message = "You've successfully created your first Tray Notification";
Notification notification = Notifications.SUCCESS;
TrayNotification tray = new TrayNotification(title, message, notification);
tray.showAndWait();

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

source
share