Enzo

Wednesday, July 3, 2013

Need some notification...?

Hi there,
last Monday I attended the JayDay conference in Munich which was organized by Anton Epple and Barbara Py. I just can say that I wish all conferences would be so nice as this one was. During the day I've added another new little project to the Enzo library...notifications. 
If you know Growl notifications you know what I'm talking about. In principle it's just little popups that will remind you on something or simply give you a short info about some event etc.
I thought it might be a good idea to have something like that available in JavaFX so here you go. At the moment you could either define your own notification or use one of the four predefined notifications.
A notification contains a title, a message and an icon (which is optional). 

Here is some code that will show you how to use it...

// Create a custom Notification without icon
Notification info = new Notification("Title", "Info-Message");

// Show the custom notification
Notifier.INSTANCE.notify(info);

// Show a predefined Warning notification
Notifier.INSTANCE.notifyWarning("This is a warning");

As you can see this is really simple and to give you an idea about how the notifications look like, here are some images...


Notifier.INSTANCE.notifySuccess("Success");

Notifier.INSTANCE.notifyInfo("Information");

Notifier.INSTANCE.notifyError("Error");

Notifier.INSTANCE.notifyWarning("Warning");
The notifications will appear on the upper right corner of the screen and will disappear after 5 sec. New notifications will always stay on top and older notifications will move down.
If you create your own notification with a given image, this image will be scaled to 24 x 24px. 
The styling is done by css and the styles could be found in the notifier.css file.

Here is a little video of the notification in action...




So that's it for today...enjoy your upcoming weekend and...keep coding... :)

5 comments:

  1. Great looking, Gerrt. Again, too bad you're not putting this into JFXtras.

    ReplyDelete
  2. Ahhh! Now i know where i knew you from.

    I read your blog for a while now :)

    Was a great event

    ReplyDelete
  3. In Windows 8 and Windows Xp the style of the popup is different from your screenshot.Pop-ups are lighter and the text is difficult to read.

    ReplyDelete
    Replies
    1. Hi Daniele,
      Could you send me a screenshot so that I could fix that problem for Windows?
      Cheers and thanx for the info,

      Gerrit

      Delete