Java TrayIcon message close button

萝らか妹 提交于 2019-12-23 13:13:40

问题


The real question here might be if there's a better way to display desktop messages in Java. However...

I'm using the Java trayicon to display messages to a desktop user. Because they want to keep certain messages up until the user clicks on them, in order to use the 'displayMessage' feature, I have to keep displaying them until the user clicks on them and I get an action command. However, if the user clicks on the little close button, I don't get an action command.

I'm developing this on linux, but the users are on windows, which complicates the testing. Also, obviously this isn't what the trayicon functionality was designed for, so if there's a better way to do this, let me know.

Thanks in advance.


回答1:


What about just using a dialog window, e.g. java.swing.JOptionPane.showConfirmDialog(...)?

Here's an article about it: http://download.oracle.com/javase/tutorial/uiswing/components/dialog.html



来源:https://stackoverflow.com/questions/1868510/java-trayicon-message-close-button

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!