Playing a .wav sound file in JPanel/JFrame using javax (Swing)

Posted by JavaIceCream on Stack Overflow See other posts from Stack Overflow or by JavaIceCream
Published on 2010-03-16T23:20:02Z Indexed on 2010/03/16 23:21 UTC
Read the original article Hit count: 172

Filed under:
|
|
|
|

I need some code example on how I would use a filepath from a harddrive location to then play a .wav sound file when opened in swing GUI. I don't need it to show a play button, or pause or stop. I just want it to play when I select the 'Sound' option from my 'Files' in my window (I know how to do that already, no need to explain that).

So basically, just how to play a .wav sound file from a filepath (i.e. c:/cake/thereisnone.wav) inside of a JFrame.

And how can I easily apply methods to that sound file afterwards.

Also, if anyone knows how to apply methods on a BufferedImage in a JFrame, that would be helpful too.

Thank you very much everyone!

© Stack Overflow or respective owner

Related posts about java

Related posts about swing