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

📄 exercise14_3.java

📁 一款用java编写的小型数据库管理系统
💻 JAVA
字号:
import java .awt.*;
import java.awt.event.*;
import javax.swing.*;
import java .applet.*;
public class Exercise14_3 extends JApplet{
	 private AudioClip audioClip =  Applet.newAudioClip(getClass().getResource("夜曲.wav"));
     public Exercise14_3(){
	   JButton jbPlay=new JButton("Play");
	   JButton jbLoop=new JButton("Loop");
	   JButton jbStop=new JButton("Stop");
	   setLayout(new FlowLayout());
	   add(jbPlay);
	   add(jbLoop);
	   add(jbStop);
	    jbPlay.addActionListener(new ActionListener(){
		   public void actionPerformed(ActionEvent e){
              audioClip.play();
			   }
		    });
		jbLoop.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e){
			   audioClip.loop();
				}
			});
		jbStop.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e){
			   audioClip.stop();
			    }
			 });
   }

   public  static void main(String[]args){
	   JFrame frame = new JFrame("Exercise14_3");
	   Exercise14_3 applet = new Exercise14_3();
	   frame.getContentPane().add(applet, BorderLayout.CENTER);
	   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	   frame.setLocationRelativeTo(null);
	   frame.pack();
	   frame.setVisible(true);
   }
}

⌨️ 快捷键说明

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