开发者

Java GUI How to Popup Message Windows like MSN Messenger

My Java application sometimes stays at system tray, just like MSN messenger does. I need popup a window to display some formated texts. Sometimes there is more than 1 message entry. I need to display them all.

I开发者_如何学Python am new to jave Swing/GUI.

Anyone has idea or experience on this?


I haven't had the opportunity to work with the Java system tray functionality yet, but you might be interested in reading this overview.

One particular section that appears to describe what you want is this:

Finally, if you wish to casually notify the user of a change in application status using a tooltip from the tray icon, use the displayMessage() method. This method displays a popup message near the tray icon, which will disappear after a time or if the user clicks on it. Clicking on the message may trigger an ActionEvent, depending on the platform.

That sounds like it describes what you want to do, but I'm not sure if there are any limitations on it. With that, the SystemTray and TrayIcon classes might be of interest as well, although I'm guessing that you've read them already.


The system tray functionality in Java 6 allows you to do what you want. Namely have an icon there, which your application can then react to. The functionality to show a message bubble is available.

I have found that the display of multiple individual messages varies a lot between platforms, so I would group them together in a time interval and show them together instead of individual bubbles.

Have a look at http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/systemtray/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜