Hi, I have a song that is played when a user click on a button. When they close the window, the song should end, but it doesn't. I even have the songs stop playing in the stop() and destroy() functions, but it isn't working. It only works when it runs in eclipse's applet viewer.
AudioClip song; ..... public void actionPerformed(ActionEvent evt) { if(evt.getSource() == song1) { song= getAudioClip(getDocumentBase(), "In The End.wav"); playSong(); } else if(evt.getSource() == song2) { song = getAudioClip(getDocumentBase(), "What I've Done.wav"); playSong(); } else if(evt.getSource() == song3) { song = getAudioClip(getDocumentBase(), "New Divide.wav"); playSong(); } else if(evt.getSource() == song4) { song = getAudioClip(getDocumentBase(), "Somewhere I Belong.wav"); playSong(); } } public void destroy() { if(isPlaying) song.stop(); } public void stop() { if(isPlaying == true) song.stop(); }