1

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

Whenever that frame pops up, I want a sound to be played.

How can I do that in Swing?

Peter Lang
  • 54,264
  • 27
  • 148
  • 161
harishtps
  • 1,439
  • 7
  • 20
  • 35
  • 1
    Swings are what kids play on at the park... I think you mean Swing :) – William Nov 02 '10 at 10:59
  • Note: http://stackoverflow.com/questions/2335601/reliably-playing-a-short-sound-in-java – Thomas Nov 02 '10 at 13:59
  • possible duplicate of [How can I play sound in Java?](http://stackoverflow.com/questions/26305/how-can-i-play-sound-in-java) – oezi Nov 08 '10 at 10:07

3 Answers3

2

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

marsl
  • 959
  • 1
  • 14
  • 25
0

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

Community
  • 1
  • 1
Tomas Narros
  • 13,390
  • 2
  • 40
  • 56
0

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

Daniel Voina
  • 3,185
  • 1
  • 27
  • 32