Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Getting audio to play in the background of my GUI.

Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'd like to be able to play audio in the background of my GUI using a JFRAME, is this possible?

I just want to load one audio file and have another play upon certain actions. I don't want audio to be selectable or anything I just want it to play as the GUI runs.

If anyone could start me off onwhere to look or give me a code snippet to get me going I'd really appreciate it. I've looked around abit and can't really find much.
Ranch Hand
Posts: 15304
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This article from OnJava might help you out a bit. And BTW, I found it as well as many others with a simple google search using Java Swing play wav file.
[ March 31, 2006: Message edited by: Gregg Bolinger ]
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm still having loads of trouble with this.

I'm trying to embed ONE audiofile into my gui to load on startup as the gui is initialised. I've tried an AudioClip interface method using the getDocumentBase() method when loading the sounds but I get an error saying 'cannot find symbol - getDocumentBase'

I've tried another way using the following code -

Inside my gui, don't get any errors but nothing happens when i call the method.

Can someone help me?
[ April 05, 2006: Message edited by: Gregory Kodikara ]
WARNING! Do not activate jet boots indoors or you will see a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic