java 播放音频 没有声音
源代码:importjava.applet.*;importjava.awt.*;importjava.awt.event.*;publicclassshengyinex...
源代码:import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class shengyin extends Applet implements ActionListener
{
AudioClip clip=new AudioClip();
Button buttonplay,buttonloop,buttonstop;
public void init()
{
clip=getAudioClip(getCodeBase(),"048.wav");
buttonplay=new Button("开始播放");
buttonloop=new Button("循环播放");
buttonstop=new Button("停止播放");
buttonplay.addActionListener(this);
buttonloop.addActionListener(this);
buttonstop.addActionListener(this);
add(buttonplay);
add(buttonloop);
add(buttonstop);
}
public void stop()
{
clip.stop();
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==buttonplay)
{
clip.play();
}
else if (e.getSource()==buttonloop)
{
clip.loop();
}
if(e.getSource()==buttonstop)
{
clip.stop();
}
}
}
能编译通过 运行能出现画面 就是点击后没有声音出来 展开
import java.awt.*;
import java.awt.event.*;
public class shengyin extends Applet implements ActionListener
{
AudioClip clip=new AudioClip();
Button buttonplay,buttonloop,buttonstop;
public void init()
{
clip=getAudioClip(getCodeBase(),"048.wav");
buttonplay=new Button("开始播放");
buttonloop=new Button("循环播放");
buttonstop=new Button("停止播放");
buttonplay.addActionListener(this);
buttonloop.addActionListener(this);
buttonstop.addActionListener(this);
add(buttonplay);
add(buttonloop);
add(buttonstop);
}
public void stop()
{
clip.stop();
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==buttonplay)
{
clip.play();
}
else if (e.getSource()==buttonloop)
{
clip.loop();
}
if(e.getSource()==buttonstop)
{
clip.stop();
}
}
}
能编译通过 运行能出现画面 就是点击后没有声音出来 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询