Play sound from a JFrame

Hello there,

I've been trying to make a game but i need to play some sounds to make it cool.

As far as I know the only way to play sounds is with a Applet (don't know if it is possible from a JApplet too), but my program is a JFrame application, not an Applet... I've tried a couple things but didn't work... is there any way to play sounds from a JFrame? (calling static methods or something alike) or I'll have to re-write my code so it is an Applet?

I would really appreciate some help with this. Thank you in advance.

[552 byte] By [Metallana] at [2007-10-2 5:37:13]
# 1

>As far as I know the only way to play sounds is with a Applet

Check out the Applet method:

newAudioClip(URL url)

Its static, so you don't even need to create an Applet.

>don't know if it is possible from a JApplet too

JApplet extends Applet

You might also check out javax.sound.midi and javax.sound.sampled

They are much harder to work with, but provide greater functionality.

IanSchneidera at 2007-7-16 1:47:43 > top of Java-index,Java Essentials,Java Programming...
# 2
Thank you, I'll check them out.So I wasn't so wrong about there should be an static method to solve my problem... noob me...
Metallana at 2007-7-16 1:47:43 > top of Java-index,Java Essentials,Java Programming...
# 3
I think I'll keep using AudioClips becouse I don't @#€$%& unsderstand how to use those other two... thanks anyways for your intention...
Metallana at 2007-7-16 1:47:43 > top of Java-index,Java Essentials,Java Programming...