我所运行的程序如下:
import java.awt.Graphics;
import java.applet.Applet;
public class HWloop extends Applet {
AudioClip sound; //声音片断对象
public void init( ){
sound=getAudioClip("hello.wav"); //获得声音片断
}
public void paint(Graphics g) {
g.drawString("hello Audio",25,25); //显示字符串
}
public void start( )
{
sound.loop( ); //声音片断开始播放
}
public void stop( ){
sound.stop( ); //声音片断停止
}
}
调试的时候提示:
E:\java学习\练习\初级阶段\Property\4\HWloop\src\HWloop.java:15: cannot find symbol
symbol : class AudioClip
location: class HWloop
AudioClip sound; //声音片断对象
^
E:\java学习\练习\初级阶段\Property\4\HWloop\src\HWloop.java:18: cannot find symbol
symbol : method getAudioClip(java.lang.String)
location: class HWloop
sound=getAudioClip("hello.wav"); //获得声音片断
^
2 errors
Process completed.