Skip to main content
Last updated July 13, 2011 05:50, by fgattung

Simple Tray Notify Wiki

SimpleTrayNotify let's you create a small tray notify window that is displayed on the lower right corner of the users screen. In it's default settings, it is similar to windows balloon tips, but has the capability to include a button and let's the user trigger an action. I made this for a project of mine and as I did not find something similar on the web, I thought I made as well share it and help a few people safe a few hours worth of work.


Click here for a quick java web start demo of the example

This currently works under windows only as it uses jna to retrieve the user work area. Note as it fades away automatically after a few seconds if you do not hover it with the mouse.


  • Uses WIndows work area so taskbar is not made invisible
  • Current version allows only for vertical fade in, but other variants could easily be implemented
  • MIT license, so use it for all of your projects
  • Includes pleasant looking, windows-style default Frame
  • any JFrame can be animated
  • location and transparency will be animated
  • see the various setters in

Download / Source Code

No packaged or .jar'ed version currently available, simply check out the classes from svn (or go to Project Features -> Source Code Repository)

3 Phases

The animation occurs in 3 phases

  1. fade-in: animation from below the screen up to the place above the taskbar, simulateneosly the opacity is increased from 0 to 1
  2. stay phase - nothing happens
  3. fade-out opacity is decreased from 1 to 0

If during any of the phases, the mouse wlll hover over the frame, the fade-out phase is cancelled and the user has to manually close the window with the close button [ X ] on the top right corner, or the window has to be closed by code.

In, use setFps(int), setNumPixelsFromLowerScreen(int), setNumPixelsFromRightScreen(in),, setStartTransparency(float), setEndTransparency(float),setFadeInDuration(floa), setShowDuration(float) and setFadeOutDuration(float) to configure the 3 phases if you need other than the default values.

I might add javadocs later, feel free to request them or contribute.

Introduction / Example

SimpleTrayNotify consists of 2 main classes. One is called TrayNotifier and it manages the animation and fade in of a JFrame, the other is SimpleNotifyFrame, which is a basic but kind of generic Frame that looks a little bit like windows balloon tips. Let's dive in:

TrayNotifier is very simple to use, juse do something like this:

JFrame frame = new JFrame(...)
/* create your frame */
TrayNotifier tn = new TrayNotifier(frame);;
and the frame will be slided in on the lower right side of your monitor.

In order to use the SimpleNotifyFrame have a look at this:

SimpleNotifyFrame frame = (new SimpleNotifyFrame())	// all SimpleNotifyFrame setters supports chaining
				.enableHeader("This is the header!")		// set the headers string
				.enableContent("This is some content text. Its a bit longer than the header, but this does not really matter!") // set the content string
				.enableIcon(MessageType.WARNING)			// uses the WARNING, ERROR, INFO and NONE enum fron TrayIcon
				.enableDraggable()							// SimpleNotifyFrame is by default undecorated and has a final, unmovable position. enableDraggable() will allow it to be dragged after the animation has been finished.
				// add your own button and optional ActionListener
				.enableActionButton("Click here", new ActionListener() {

					public void actionPerformed(ActionEvent arg0) {
						JOptionPane.showMessageDialog(null, "Test Message");



		TrayNotifier tn = new TrayNotifier(frame);;

See in the sources for a running example.

Please Confirm