Java 程序里如何加载声音?
展开全部
import java.awt.Graphics;
import java.applet.Applet;
import java.applet.AudioClip;
public class HWloop extends Applet {
AudioClip sound;
public void init()
{
System.out.println(getCodeBase());
sound=getAudioClip(getCodeBase(),"1.wav"); //sound.play();
}
public void paint(Graphics g) {
g.drawString("hello Audio",250,250); }
public void start( )
{
sound.play(); }
public void stop( )
{
sound.stop( ); }
}
import java.applet.Applet;
import java.applet.AudioClip;
public class HWloop extends Applet {
AudioClip sound;
public void init()
{
System.out.println(getCodeBase());
sound=getAudioClip(getCodeBase(),"1.wav"); //sound.play();
}
public void paint(Graphics g) {
g.drawString("hello Audio",250,250); }
public void start( )
{
sound.play(); }
public void stop( )
{
sound.stop( ); }
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询