开发者

Playing sound when showing popup in Swing?

开发者 https://www.devze.com 2023-01-23 16:45 出处:网络
I have a frame which pops up whenever an event occurs. Whenever that frame pops up, I want开发者_Go百科 a sound to be played.

I have a frame which pops up whenever an event occurs.

Whenever that frame pops up, I want开发者_Go百科 a sound to be played.

How can I do that in Swing?


A very simple solution is using Toolkit.getDefaultToolkit().beep();


Check this question in this same site: How can I play sound in Java?


Subclass JDialog or similar and on the constructor/setVisible method of the derived class play a sound with one of the fore mentioned methods.

0

精彩评论

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