AudioClip: play() : AudioClip : java.awt : Java by API examples (example source code) Organized by topic

Java by API
C++
PHP
Java by API Home »  java.awt   » [  AudioClip  ]   
 



AudioClip: play()


import java.applet.Applet;
import java.applet.AudioClip;
import java.net.URL;

public class MainClass {
  public static void main(String[] args) {
    try {
      URL url = new URL("file:youraudiofile.wav" );
      AudioClip ac = Applet.newAudioClip(url);
      ac.play();

      System.out.println("Press any key to exit.");
      System.in.read();
      ac.stop();
    catch (Exception e) {
      System.out.println(e);
    }
  }
}
           
       
Related examples in the same category
1.  AudioClip: stop()
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.