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

📄 minegrid.java

📁 基于J2ME的手机游戏扫雷,源码含解,方便学习!
💻 JAVA
字号:
package nicholas.game.mine;

import java.awt.*;

import javax.swing.*;

public class MineGrid extends JLabel {
	
	public static final int CLICKED = 0;
	public static final int LABELED = 1;
	public static final int NORMAL = 2;
	public static final int SIZE = 16;
	
	public static int xBound;
	public static int yBound;
	
	private int x, y;
	private int status;
	private boolean mark;
	
	int xlow;
	int ylow;
	int xhigh;
	int yhigh;
	
	public MineGrid(int x, int y) {
		
		super();
		this.x = x;
		this.y = y;
		status = NORMAL;
		mark = false;
		xhigh = x;
		yhigh = y;
		xlow = x;
		ylow = y;
		if(x>0) xlow--;
		if(x<xBound-1) xhigh++;
		if(y>0) ylow--;
		if(y<yBound-1) yhigh++;
	}
	
	public void setMarked(boolean m) {
		mark = m;
	}
	
	public boolean isMarked() {
		return mark;
	}
	
	public void setStatus(int s) {
		status = s;
	}
	
	public int getXpos() {
		return x;
	}
	
	public int getYpos() {
		return y;
	}
	
	public boolean isClicked() {
		return status == CLICKED;
	}
	
	public boolean isLabeled() {
		return status == LABELED;
	}
	
	public boolean isNormal() {
		return status == NORMAL;
	}
}

/********************************************\
* status  clickable  labelable  doubleClick  *
*clicked    false      false       true      *
*labeled    false      true        false     *
* normal    true       true        false     *
\********************************************/

⌨️ 快捷键说明

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