Is it possible to have sound in a JOptionPane message?
posted 7 years ago
I'm working on an assignment. I have everything I need but I want to give it an extra. My program gives the results in a JOptionPane window and I want it to make a sound (a simple sound, nothing complex) when the window pops up. Is there a way to do it? Can you guys guide me or give me a link to the info of how it can be done?
Thanks in advance
Check out the Toolkit class API for a method which will let you beep (hint).
Remember, JOptionPane.showXXXDialog are all holding calls. If you do not take this into consideration, you will not hear the beep until your dialog closes.