问题
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