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

📄 testclip.java

📁 about the java chat by kevin
💻 JAVA
字号:
import java.applet.*;
import java.awt.event.*;
import java.awt.*;

public class TestClip extends Applet implements ActionListener,ItemListener
{
	AudioClip clp;
	Button ply,stp,lop;
	Choice chi;
	
	public void init()
	{
		this.setLayout(null);
		setBackground(Color.red);
		setForeground(Color.cyan);
		setFont(new Font("serif",42,Font.BOLD));
		chi=new Choice();
		chi.add("bj1.mid");
		chi.add("bj2.mid");
		add(chi);
		chi.setBounds(100,100,300,300);
		chi.addItemListener(this);
		ply=new Button("play");
		stp=new Button("stop");
		lop=new Button("loop");
		ply.addActionListener(this);
		stp.addActionListener(this);
		lop.addActionListener(this);
		clp=getAudioClip(getCodeBase(),"bj1.mid");
		
	}
	
	public void itemStateChanged(ItemEvent e)
	{
		if(e.getItemSelectable()==chi)
		{
			if(chi.getSelectedIndex()==0)
			clp=getAudioClip(getCodeBase(),"bj2.mid");
		}
		else return ;
		}
		
	public void actionPerformed(ActionEvent e)
	{
		if(e.getSource()==ply)
		clp.play();
		else if(e.getSource()==stp)
		clp.stop();
		else clp.loop();
		}
}

⌨️ 快捷键说明

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