<pre t="code" l="java">package test;
import java.applet.AudioClip;
import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.JApplet;
public class YuGiOh
{
public static AudioClip loadSound ( String filename )
{
URL url = null;
try
{
url = new URL ("file:" + filename);
}
catch (MalformedURLException e)
{}
return JApplet.newAudioClip (url);
}
public static void main ( String[] args )
{
AudioClip audioClip = loadSound ("keyboard.wav");
audioClip.play ();
}
}
温馨提示:内容为网友见解,仅供参考