I've looked on Google for a while, searching how to play audio files, and most of the sources I found were with using java.applet.*
, but I am trying to look for a way I can put it inside my actionPerformed()
method.
public void actionPerformed(ActionEvent event) {
if(event.getActionCommand().equals("Play")){
//Short Audio File Playing Here
}
}
You may learn and use
javax.sound
API. Have a look at tutorial - Playing Back Audio.See the JavaSound info. page for the "Playing a Clip" section.