Skip to content

Instantly share code, notes, and snippets.

@rdp
Created December 19, 2012 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rdp/4338167 to your computer and use it in GitHub Desktop.
Save rdp/4338167 to your computer and use it in GitHub Desktop.
import java.awt.*;
import java.awt.event.*;
class repro {
public static void main(String[] args) throws Exception {
SystemTray tray = java.awt.SystemTray.getSystemTray();
Image image = java.awt.Toolkit.getDefaultToolkit().getImage("");
TrayIcon trayIcon = new TrayIcon(image, "name", null);
tray.add(trayIcon);
trayIcon.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
System.out.println("in here " + evt.getActionCommand() + " " + evt.getModifiers() + " " + evt.paramString() + " " + evt.getID());
}
});
trayIcon.displayMessage("title", "try clicking within the baloon, but not the x, then double clicking the tray icon", TrayIcon.MessageType.INFO);
System.out.println("try clicking within the balloon message, or double clicking, both seem to generate the same event");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment