标题:添加声音 但是为什么听不到志声音?
只看楼主
zzxwill
Rank: 1
等 级:新手上路
帖 子:398
专家分:0
注 册:2007-8-15
 问题点数:0 回复次数:1 
添加声音 但是为什么听不到志声音?
package javaDaZuoYe;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
/*
 * 添加声音 但是为什么听不到志声音?
 */
public class AudioJApplet extends JApplet implements ActionListener{
    AudioClip au;
    JButton JBstart=new JButton("Play");
    JButton JBpause=new JButton("Pause");
    
    public void init(){
        au=getAudioClip(getCodeBase(),"1.mid");
        this.setLayout(new FlowLayout());
        this.add(JBstart);
        this.add(JBpause);
        JBstart.addActionListener(this);
        JBpause.addActionListener(this);
    }
    
    public void actionPerformed(ActionEvent e){
        String cmd=e.getActionCommand();
        if(cmd.equals("Play")){
            au.loop();
        }
        else if(cmd.equals("Pause")){
            au.stop();
        }
        
    }
    
    public void stop(){
        au.stop();
        
    }
    
}
搜索更多相关主题的帖子: 志声音 import java JButton 
2007-12-01 22:39
netstriker
Rank: 1
等 级:新手上路
威 望:1
帖 子:257
专家分:0
注 册:2007-3-24
得分:0 
是不是路径名有问题?提示说找不到文件?
2007-12-02 09:52



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-189805-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.468815 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved