Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebNotificationPopup for JApplet #125

Closed
moizhb opened this issue May 19, 2014 · 4 comments
Closed

WebNotificationPopup for JApplet #125

moizhb opened this issue May 19, 2014 · 4 comments
Assignees
Labels

Comments

@moizhb
Copy link

moizhb commented May 19, 2014

How can I have Notification popups for a JApplet?

WebNotificationPopup popup = new WebNotificationPopup(NotificationStyle.mac);
popup.setContent(msg);
popup.setIcon(icon);
popup.setDisplayTime(timeout);
NotificationManager.showNotification(popup);

I am calling this inside Japplet and I get the following error:
Exception in thread "AWT-EventQueue-1" java.lang.NullPointerException
at com.alee.managers.popup.PopupManager.getPopupLayer(PopupManager.java:226)
at com.alee.managers.popup.PopupManager.getPopupLayer(PopupManager.java:209)
at com.alee.managers.notification.NotificationManager.showNotification(NotificationManager.java:494)
at com.alee.managers.notification.NotificationManager.showNotification(NotificationManager.java:482)

Not sure if it is designed to work with JApplet.

@mgarin
Copy link
Owner

mgarin commented May 20, 2014

Since you are using an applet there are no active windows in the application by default and PopupManager cannot automatically find a parent for your notification. So you have to provide it manually in showNotification method:

WebNotificationPopup popup = new WebNotificationPopup ( NotificationStyle.mac );
popup.setContent ( msg );
popup.setIcon ( icon );
popup.setDisplayTime ( timeout );
NotificationManager.showNotification ( myApplet, popup );

This way it should work.

mgarin added a commit that referenced this issue May 20, 2014
@mgarin
Copy link
Owner

mgarin commented May 20, 2014

I have added a small improvements for the exceptions thrown in this case.
Though it might not always tell you what exactly is missing.

Anyway, notification should be displayed properly if you will use the method I recommended.

@mgarin mgarin closed this as completed May 20, 2014
@mgarin mgarin added this to the Small issues milestone May 20, 2014
@mgarin mgarin self-assigned this May 20, 2014
@moizhb
Copy link
Author

moizhb commented May 21, 2014

Thank you so much mgarin. You're awesome!!

@mgarin
Copy link
Owner

mgarin commented May 22, 2014

Always welcome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants