📄 exit.java
字号:
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.FileInputStream;
import javax.swing.*;
import sun.audio.AudioPlayer;
import sun.audio.AudioStream;
public class exit extends JFrame{
Icon pic =new ImageIcon("back3.jpg");
JLabel label=new JLabel("", pic, 0);
Icon pic1 =new ImageIcon("ben.gif");
JLabel labe2=new JLabel("", pic1, 0);
Icon pic2 =new ImageIcon("te.gif");
JLabel labe3=new JLabel("", pic2, 0);
int n=0;
public static int i=550;
public exit(){
super("谢谢游戏!");
if(Option.musicvalue==true&&Caidan.muvalue==true){
try {
FileInputStream fileau=new FileInputStream("end.wav" );
AudioStream as=new AudioStream(fileau);
AudioPlayer.player.start(as);
}
catch (Exception e1) {}
}
labe2.setLocation(80,20);
labe2.setSize(200,41);
add(labe2);
final ImageIcon p1 =new ImageIcon("jin.gif");
final ImageIcon p2 =new ImageIcon("cheng.gif");
final ImageIcon p3 =new ImageIcon("chen.gif");
final ImageIcon p4 =new ImageIcon("meng.gif");
final JLabel j3=new JLabel();
final ImageIcon p5 =new ImageIcon("xiong.gif");
final ImageIcon p6 =new ImageIcon("li.gif");
final ImageIcon p7 =new ImageIcon("xiong.gif");
final ImageIcon p8 =new ImageIcon("li.gif");
final JLabel j4=new JLabel();
ActionListener listener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
ImageIcon im1[] = { p1, p2,p3, p4 };
ImageIcon im2[] = { p5, p6,p7,p8 };
j3.setIcon(im1[n]);
j4.setIcon(im2[n]);
n++;
if (n == 4) {
n = 0;
}
}
};
Timer timer = new Timer(1000, listener);
timer.start();
j4.setLocation(275,220);
j4.setSize(200,40);
add(j4);
j3.setLocation(285,70);
j3.setSize(115,40);
add(j3);
labe3.setLocation(80,140);
labe3.setSize(163,39);
add(labe3);
label.setBounds(0,0,600,400);
add(label);
setSize(600,400);
setLocation(200,150);
setVisible(true);
setLayout(null);
this.setResizable(false);
}
public static void close(){
System.exit(0);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -