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

📄 whitenamedialog.java

📁 简单的防XP扫雷代码
💻 JAVA
字号:
package com.by.brt.mine;

import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;

import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

/**
 * 游戏胜利后弹出来的留名框类.
 * 
 * @author brt
 * 
 */
public class WhiteNameDialog extends JDialog implements ActionListener {

	private JLabel l1, l2;

	private JTextField tf;

	private JButton btn;

	private Box box, boxmain;

	private JPanel temp;

	/**
	 * 存放初级记录的姓名和时间的集合.
	 */
	public static List<Hero> list1 = new ArrayList<Hero>();

	/**
	 * 存放中级记录的姓名和时间的集合.
	 */
	public static List<Hero> list2 = new ArrayList<Hero>();

	/**
	 * 存放高级记录的姓名和时间的集合.
	 */
	public static List<Hero> list3 = new ArrayList<Hero>();

	/**
	 * 游戏胜利后弹出来的留名框类的构造方法.
	 * 
	 */
	public WhiteNameDialog() {
		super(MineClient.mf, true);
		init();
	}

	private void init() {

		box = Box.createVerticalBox();
		boxmain = Box.createHorizontalBox();

		l1 = new JLabel("已经破记录。");
		l2 = new JLabel("大侠请留名。");

		tf = new JTextField("匿名");

		btn = new JButton("确定");
		btn.addActionListener(this);

		box.add(Box.createVerticalStrut(10));

		box.add(l1);
		box.add(l2);
		box.add(Box.createVerticalStrut(40));
		box.add(tf);
		box.add(Box.createVerticalStrut(20));
		temp = new JPanel(new FlowLayout());
		temp.add(btn);
		box.add(btn);
		box.add(Box.createVerticalStrut(20));

		boxmain.add(Box.createHorizontalStrut(30));
		boxmain.add(box);
		boxmain.add(Box.createHorizontalStrut(30));

		this.add(boxmain);
		this.setTitle("破记录啦");
		this.setSize(165, 200);
		this.setLocationRelativeTo(MineClient.mf);
		this.setResizable(false);
		this.setVisible(true);
		this.setModal(true);
	}

	/**
	 * 弹出框中的按钮的监听方法..
	 */
	public void actionPerformed(ActionEvent e) {
		if (e.getSource() == btn) {

			int time = 0;
			String name = "";
			if (MineClient.mf.getLevel() >= 1 && MineClient.mf.getLevel() <= 3) {
				if (MineClient.mf.getLevel() == 1) {
					name = tf.getText();
					time = MineClient.mf.getTime();
					list1.add(new Hero(time, name));
				} else if (MineClient.mf.getLevel() == 2) {
					name = tf.getText();
					time = MineClient.mf.getTime();
					list2.add(new Hero(time, name));
				} else if (MineClient.mf.getLevel() == 3) {
					name = tf.getText();
					time = MineClient.mf.getTime();
					list3.add(new Hero(time, name));
				}
				dispose();
				HeroDialog hd = new HeroDialog();
			}
		}
		dispose();
	}
}

⌨️ 快捷键说明

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