Add EventHandler to AudioClip?

Discussion in 'Java' started by SimonSimon, May 8, 2006.

  1. SimonSimon

    SimonSimon Guest


    I have a java applet with a sound playing in the background. If I click
    on a spot in the picture, another sound should play and the sound in
    background should stop. I would like to play again this background
    sound, when the second sound finishes playing. I hope I wrote clear
    enough :)

    This is my code:
    catch(Exception e)
    clip = applet.getAudioClip(applet.getCodeBase(), file);;

    If I'm correct, I would need an EventHandler for AudioClip, and this
    EventHandler would lood for method stop(). Am I correct? How can I do

    SimonSimon, May 8, 2006
    1. Advertisements

  2. SimonSimon

    Oliver Wong Guest

    AudioClip doesn't allow you to register listeners on it. Use the Clip
    interface instead:

    - Oliver
    Oliver Wong, May 8, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.