Advertisement Jump to content
Sign in to follow this  

Sounds in Java Application

This topic is 4982 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi i have a simple scroller shooter with several classes with the ships being in the a panel and the panel is in a frame now how do can I make it play a sound and where should the code be? The internat has been most unhelpfull with the

Share this post

Link to post
Share on other sites
<disclaimer>I don't have much experience with this myself and everything i say here is strictly from the API </disclaimer>

I can see two possible ways of doing this from the API (both of which may or may not work).

The first is using the Play(URL url) method from the applet class. This seems like as long as your are giving it the correct path it should play the audio file you want.

If that doesn't work, I'd check out the newAudioClip(URL url) or getAudioClip(URL url) methods to instantiate an AudioClip object and then use the AudioClip class's play (or loop) method to work the audio.

API just in case you weren't looking at it...but I'm sure you've had a look.

Hope this works,

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!