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

📄 hlepwindow.java

📁 java Labyrinth game;Provides two kinds to produce map s way stochastically: The stochastic distribut
💻 JAVA
字号:
package src;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.Color;
import javax.swing.*;

/*
 * 产生帮助窗口
 * 真是尴尬,help写成了hlep!!!
 */
public class HlepWindow extends JFrame {
	private static int isCreated = 0;
	final Icon logoImage = new ImageIcon("inco\\man.gif");
	final JLabel logoimagePosition = new JLabel(logoImage);
	final JTextArea txt = new JTextArea(13, 19);
	final JButton close = new JButton("关闭");

	private JPanel cons = new JPanel();

	public HlepWindow() {
		super("帮助");
		isCreated = 1;
		this.setIconImage(new ImageIcon("inco\\help.png").getImage());// 图标
		this.setVisible(true);
		this.setLocationRelativeTo(null);// 实现窗口的最佳位置
		this.setSize(410, 310);
		this.setResizable(false);// 不可再改变大小
		this.add(cons);

		cons.setBackground(Color.white);

		cons.add(logoimagePosition, BorderLayout.WEST);
		cons.add(txt, BorderLayout.EAST);
		cons.add(close, BorderLayout.SOUTH);

		txt.setBackground(Color.white);
		txt.setEditable(false);
		txt.setText("\n         迷宫游戏\n\n" + "         系统默认的难度为令人发狂的,但在\n"
				+ "         选择难度的时候会显示不正常,这是" + "\n         程序的一个缺陷"
				+ "\n         提供了随机生成地图方法和图的深度" + "\n         优先遍历法生成地图两种方式   "
				+ "\n\n         任何建议,或者发现了其它的不足" + "\n         请联系: B.Lee" + ""
				+ "\n         lage629@hotmail.com");

		this.addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				MazeGame.setinfOut("关闭帮助窗口");
				isCreated = 0;
				setVisible(false);
			}
		});
		this.addWindowListener(new WindowAdapter() {// 帮助窗口失去焦点,自动关闭
					public void windowDeactivated(WindowEvent e) {
						MazeGame.setinfOut("帮助窗口已关闭");
						isCreated = 0;
						setVisible(false);
					}
				});
		close.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {// 关闭
				MazeGame.setinfOut("关闭帮助窗口");
				isCreated = 0;
				setVisible(false);
			}
		});
	}

	public static int getisCreated() {
		return isCreated;
	}
}

⌨️ 快捷键说明

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