Hello World!

Im doing a simple program that runs a JFrame and has some JButtons etc etc but id like to put a simple sound to one of my buttons, when i quit the program i want it to play a simple melody how can i put it in this simple button? this is where id like to put it but i cant find how to put in in there:

public class quitHandler implements ActionListener{
		public void actionPerformed(ActionEvent ae){
		/*here i guess i should put some kind of method or something*/	
                System.exit(0);
		}
	}

Recommended Answers

There are a couple of ways to play a simple sound in Java. This explains the newer. better (but harder) way:
http://www.anyexample.com/programming/java/java_play_wav_sound_file.xml
and this is the older, simpler,way:

Jump to Post

All 2 Replies

I'll check them out thanks a lot =)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.