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

📄 images.java

📁 扫雷的源代码,包结构采用经典的MVC模式,包括模型、控制、视图三部分
💻 JAVA
字号:
/*
 * Created on Apr 7, 2005
 *
 * TODO load the image to memory when this program is loaded, then program can
 * use image from memory directly
 */
package view;

import java.awt.Image;
import java.net.URL;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;

import li.JMineSweeper;

/**
 * @author mqqqvpppm
 * 
 * TODO load the image to memory when this program is loaded, then program can
 * use image from memory directly
 */
public class Images {
	/** Returns an ImageIcon, or null if the path was invalid. */
	protected static javax.swing.ImageIcon createImageIcon(String path) {
		java.net.URL imgURL = JMineSweeper.class.getResource(path);
		if (imgURL != null) {
			return new javax.swing.ImageIcon(imgURL);
		} else {
			System.err.println("Couldn't find file: " + path);
			return null;
		}
	}

	protected static Image createImage(String path) {
		try {
			URL imgURL = JMineSweeper.class.getResource(path);
			Image ret = ImageIO.read(imgURL);
			return ret;
		} catch (Exception exception) {
			return null;
		}
	}
	
	public static final Image FRAME_IMAGE = createImage("images/mainFrameIcon.gif");

	public static final ImageIcon START_BEGIN = createImageIcon("images/START_BEGIN.gif");

	public static final ImageIcon START_RUN = createImageIcon("images/START_RUN.gif");

	public static final ImageIcon START_END = createImageIcon("images/START_END.gif");

	public static final ImageIcon[] number = { createImageIcon("images/1.gif"),
			createImageIcon("images/2.gif"), createImageIcon("images/3.gif"),
			createImageIcon("images/4.gif"), createImageIcon("images/5.gif"),
			createImageIcon("images/6.gif"), createImageIcon("images/7.gif"),
			createImageIcon("images/8.gif") };

	public static final ImageIcon MINE = createImageIcon("images/MINE.gif");

	public static final ImageIcon MINE_WRONG = createImageIcon("images/MINE_WRONG.gif");

	public static final ImageIcon MINE_BLAST = createImageIcon("images/MINE_BLAST.gif");

	public static final ImageIcon CLICKED = createImageIcon("images/CLICKED.gif");

	public static final ImageIcon UNCLICKED = createImageIcon("images/UNCLICKED.gif");

	public static final ImageIcon MARKED = createImageIcon("images/MARKED.gif");

	public static final ImageIcon MARKED_MINE = createImageIcon("images/MARKED_MINE.gif");

	//public static final ImageIcon FRAME_ICON =
	// createImageIcon("images/FRAME_ICON.gif");
}

⌨️ 快捷键说明

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