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

📄 images.java

📁 扫雷完整的程序
💻 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 mqqqvpppm.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 Image[] number = { createImage("images/1.gif"),
			createImage("images/2.gif"), createImage("images/3.gif"),
			createImage("images/4.gif"), createImage("images/5.gif"),
			createImage("images/6.gif"), createImage("images/7.gif"),
			createImage("images/8.gif") };

	public static final Image MINE = createImage("images/MINE.gif");

	public static final Image MINE_WRONG = createImage("images/MINE_WRONG.gif");

	public static final Image MINE_BLAST = createImage("images/MINE_BLAST.gif");

	public static final Image CLICKED = createImage("images/CLICKED.gif");

	public static final Image UNCLICKED = createImage("images/UNCLICKED.gif");

	public static final Image MARKED = createImage("images/MARKED.gif");

	public static final Image MARKED_MINE = createImage("images/MARKED_MINE.gif");


}

⌨️ 快捷键说明

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