- attached enzo_error_44.png
Using Notification leaves ghost window on taskbar
I use the NotifierBuilder
to create a notifier, and then create a Notification
using the NotificationBuilder
. When I invoke the notifier.notify(notification) method, it creates a ghost window on the Windows taskbar that doesn't disappear when the Popup disappears.
private Notification.Notifier notifier;
notifier = NotifierBuilder.create()
.popupLocation(Pos.BOTTOM_RIGHT)
.popupLifeTime(Duration.millis(10_000))
.height(120.0d)
.build();
Notification errorNotification = NotificationBuilder.create()
.title(resourceBundle.getString("title") + " - " + resourceBundle.getString("error"))
.message(notification.getErrorMessage())
.image(Notification.ERROR_ICON)
.build();
Platform.runLater(() -> notifier.notify(errorNotification));
Comments (12)
-
reporter -
repo owner Hmm...strange, this window does not appear on my Mac. Will try to fix it...
-
repo owner Can you try with last commit? I just modified some minor things but not sure if it has an effect on Windows.
-
reporter Thanks for your timely response! I have a tight timeline for my project, and this notification tool is exactly what I need. So, thank you for that as well!
I just pulled your changes, and still see the same behavior. What I have done for now is change the
showPopup
method to hide the stage if the popups list is empty. So, from this:timeline.setOnFinished(actionEvent -> Platform.runLater(() -> { POPUP.hide(); popups.remove(POPUP); fireNotificationEvent(new NotificationEvent(NOTIFICATION, Notifier.this, POPUP, NotificationEvent.HIDE_NOTIFICATION)); }));
to this:
timeline.setOnFinished(actionEvent -> Platform.runLater(() -> { POPUP.hide(); popups.remove(POPUP); if (popups.isEmpty()) { stage.hide(); } fireNotificationEvent(new NotificationEvent(NOTIFICATION, Notifier.this, POPUP, NotificationEvent.HIDE_NOTIFICATION)); }));
I also added an icon to the stage. :)
-
reporter Gerrit,
It appears as though I'm not the only one. I see that someone else commented about a similar issue a couple of weeks ago on the YouTube video for this feature of Enzo: https://youtu.be/82m0tNfx7pE
Could it be a Windows 10 thing? I kind of doubt it. It's most likely a Windows or a Java thing. If we could specify more than one StageStyle like TRANSPARENT and UTILITY, this would not be a problem.
I'm happy to assist in any way I can. I'll keep seeking answers in the meantime unless you find an answer before that.
Thanks again!
-
reporter This is a total hack. But, by setting
stage.setY(-100);
andstage.initStyle(StageStyle.UTILITY);
in theinitGraphics()
method of theNotification.Notifier
enum, the window doesn't appear on the taskbar. Nor is it visible to the user as it is off of the viewable area of the srceen. ¯_(ツ)_/¯ -
repo owner Yep I played with the same hack but did not like it much which is the reason why it is not in :) So it seems that this problem only occurs on Windows, problem for me is that I do not have a windows machine available, just OS X and Linux. Will try to find a way...
-
repo owner You might want to try the following in Notifier:
private void initGraphics() { scene = new Scene(new Region()); scene.setFill(null); scene.getStylesheets().add(getClass().getResource("notifier.css").toExternalForm()); stage = new Stage(); stage.setMinWidth(0); stage.setMinHeight(0); stage.setMaxWidth(0); stage.setMaxHeight(0); stage.setWidth(0); stage.setHeight(0); stage.initModality(Modality.NONE); stage.setResizable(false); //stage.initStyle(StageStyle.TRANSPARENT); stage.initStyle(StageStyle.UTILITY); stage.setScene(scene); stage.setAlwaysOnTop(true); }
-
repo owner Might be that the following issue is related to the problem: JavaFX Issue Tracker
-
reporter Funny. They mention the same hack I did, and they also call it what it is. A hack! :-D
-
reporter I tried the code from above, but to no avail. The window does not appear on the taskbar, but it appears on the desktop as a tiny window with only a close ('X') button.
-
reporter Here is another screenshot of the window in action.
- Log in to comment
Here is a screenshot of the window that appears.