tornadofx-controlsfx
tornadofx-controlsfx copied to clipboard
Show notification when stage is not in focused
This is probably controlsfx question but ...
Is it possible to show notification when application is collapsed or unfocused?
It's actually more of a general JavaFX question I believe :)
In a TornadoFX UIComponent you can access the currentStage property, which is a javafx.stage.Stage. It has a focusedProperty you can listen to events on, and since Stage extends javafx.stage.Window, it also has callbacks for onShowing and onHiding.
there is a scheduled task that should show notification after some time. But if app is hidden notification doesn't pop up. I am not sure I understand how this can be fixed with what you said
I misunderstood you. The title says "show notification when stage is not focused", so I thought you wanted to show a notification when the stage no longer has focus :)
You can call currentWindow?.requestFocus(), which should make the application blink in the task bar. When the user clicks the blinking application icon, your notification would appear.
That's a solution :) but there is no way to show it without focus?
I'm not sure. You can check/ask on StackOverflow with a general JavaFX question. If you find a solution, please let me know on this issue :)