⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c0ae97ef606b001c163f9a8163c77be3

📁 这是我自己照着书上敲的
💻
字号:
/*
 * Created on 2007-9-25
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/**
 * @author Administrator
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class AudioAppletDemo extends Applet implements ActionListener
{
	AudioClip ac;
	Button btnStart=new Button("开始播放");
	Button btnPause=new Button("暂停播放");
	Button btnContinue=new Button("继续播放");
	public void init()
	{
		ac=getAudioClip(getDocumentBase(),"computer.au");
		btnStart.addActionListener(this);
		btnPause.addActionListener(this);
		btnContinue.addActionListener(this);
		this.add(btnStart);
		this.add(btnPause);
		this.add(btnContinue);
	}
	public void stop()
	{
		if(ac!=null)
			ac.stop();
	}
	public void actionPerformed(ActionEvent e)
	{
		if(ac==null)
		{
			System.out.println("AudioClip object is not created!");
			return;
		}
		Object cmd=e.getSource();
		if(cmd==btnStart)
		{
			ac.play();
			ac.loop();
		}
		else if(cmd==btnPause)
		{
			ac.stop();
		}
		else if(cmd==btnContinue)
		{
			ac.play();
			ac.loop();
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -