Can JavaFX natively show OS notifications?
For anyone coming to this question in 2020, here's a stab at showing native OS notifications working with JavaFX:
https://gist.github.com/wiverson/d2edf0d66ad195c96793d0d25290753b
As noted in the sample, OS native notifications are best if the app is in the background - use ControlsFX notifications if the app is in the foreground.
This works on macOS Big Sur, should also work on Windows.
[Edit 1/5/21] Here is a project that also will help with this:
https://github.com/dustinkredmond/FXTrayIcon
Apparently javaFx Still doesn't provide way to show tray notifications, but you can use 3rd 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();