📄 音乐.java~57~
字号:
package 美女;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
import com.zdsoft.gui.*;
import com.zdsoft.datacenter.ASDatacenter;
import com.zdsoft.datastore.ASDatastore;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import ZQ.*;
import java.applet.*;
import java.net.URL;
import java.io.*;
import java.text.*;
import java.util.*;
public class 音乐 extends ASPanel{
JPanel jPanel1 = new JPanel();
JPanel jPanel2 = new JPanel();
JButton jButton2 = new JButton();
Icon ic = new ImageIcon("meinv.gif");
String s="file:/e:/MIDI音乐/老歌.mid";
String d="file:/e:/MIDI音乐/天薏.mid";
AudioClip id;
AudioClip ie;
JButton jButton1 = new JButton();
JButton jButton3 = new JButton();
JPanel jPanel3 = new JPanel();
JLabel jLabel2 = new JLabel();
JButton jButton4 = new JButton();
JButton sy = new JButton();
GridBagLayout gridBagLayout2 = new GridBagLayout();
JLabel meinv = new JLabel();
JLabel time = new JLabel();
public 音乐() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
class inters implements Runnable{
public void run(){
try {
for (; ; ) {
String s = "";
Thread.sleep(1000);
GregorianCalendar calendar = new GregorianCalendar();
s+= calendar.getTime().getHours()+":";
s+= calendar.getTime().getMinutes()+":";
s+= calendar.getTime().getSeconds();
time.setText(s);
}
}
catch (Exception ex){
}
}
}
private void jbInit() throws Exception {
inters in = new inters();
Thread t1 = new Thread(in);
t1.start();
meinv.setIcon(ic);
ie = Applet.newAudioClip(new URL(d));
this.setForeground(Color.black);
id = Applet.newAudioClip(new URL(s));
this.setDebugGraphicsOptions(0);
jButton2.setFont(new java.awt.Font("Serif", 0, 12));
jButton2.setForeground(Color.cyan);
jButton2.setText("循环播放");
jButton2.addActionListener(new 音乐_jButton2_actionAdapter(this));
jButton1.setFont(new java.awt.Font("Serif", 0, 12));
jButton1.setForeground(Color.cyan);
jButton1.setText("播放");
jButton1.addActionListener(new 音乐_jButton1_actionAdapter(this));
jButton3.setFont(new java.awt.Font("Serif", 0, 12));
jButton3.setForeground(Color.cyan);
jButton3.setText("停止");
jButton3.addActionListener(new 音乐_jButton3_actionAdapter(this));
jLabel2.setFont(new java.awt.Font("Serif", 0, 20));
jLabel2.setForeground(Color.green);
jLabel2.setText("美女我爱你");
jButton4.setFont(new java.awt.Font("Serif", 0, 12));
jButton4.setForeground(Color.cyan);
jButton4.setText("下一曲");
jButton4.addActionListener(new 音乐_jButton4_actionAdapter(this));
sy.setForeground(Color.cyan);
sy.setPreferredSize(new Dimension(83, 30));
sy.setText("");
sy.addActionListener(new 音乐_sy_actionAdapter(this));
jPanel3.setLayout(gridBagLayout2);
jPanel1.setPreferredSize(new Dimension(385, 40));
jPanel2.setPreferredSize(new Dimension(400, 500));
jPanel3.setPreferredSize(new Dimension(400, 50));
time.setText("");
this.add(jPanel1, BorderLayout.SOUTH);
jPanel1.add(sy, null);
jPanel1.add(jButton1, null);
jPanel1.add(jButton4, null);
jPanel1.add(jButton2, null);
jPanel1.add(jButton3, null);
this.add(jPanel2, BorderLayout.CENTER);
jPanel2.add(meinv, null);
this.add(jPanel3, BorderLayout.NORTH);
jPanel3.add(jLabel2, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 150, 5, 150), 0, 0));
jPanel3.add(time, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
}
void jButton2_actionPerformed(ActionEvent e) {
id.loop();
}
void jButton3_actionPerformed(ActionEvent e) {
id.stop();
ie.stop();}
void jButton1_actionPerformed(ActionEvent e) {
sy.setText("");
ie.stop();
id.play();
}
void jButton4_actionPerformed(ActionEvent e) {
id.stop();
ie.loop();
sy.setText("上一曲");
}
void sy_actionPerformed(ActionEvent e) {
id.loop();
ie.stop();
}
void jButton5_actionPerformed(ActionEvent e) {
}
}
class 音乐_jButton2_actionAdapter implements java.awt.event.ActionListener {
音乐 adaptee;
音乐_jButton2_actionAdapter(音乐 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
}
}
class 音乐_jButton3_actionAdapter implements java.awt.event.ActionListener {
音乐 adaptee;
音乐_jButton3_actionAdapter(音乐 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton3_actionPerformed(e);
}
}
class 音乐_jButton1_actionAdapter implements java.awt.event.ActionListener {
音乐 adaptee;
音乐_jButton1_actionAdapter(音乐 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}
class 音乐_jButton4_actionAdapter implements java.awt.event.ActionListener {
音乐 adaptee;
音乐_jButton4_actionAdapter(音乐 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton4_actionPerformed(e);
}
}
class 音乐_sy_actionAdapter implements java.awt.event.ActionListener {
音乐 adaptee;
音乐_sy_actionAdapter(音乐 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.sy_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -