📄 temp.java
字号:
//Class Description:This class deals with the left mouseClicked,include a
// recursive method to show the surround of a button around
// which there are no mines
class Temp{
public Temp(){}
public void set(JButton1 p){
p.changeBackground();p.setEnabled(false);
if(p.getContent()==0)
p.setText("");
else
p.setText(Integer.toString(p.getContent()));
}
public void solveMine(JButton1 b) throws ArrayIndexOutOfBoundsException{
int i=b.getRow(),j=b.getColumn();
int[] a=new int[3];
a[0]=-1;a[1]=0;a[2]=1;
int[] a1=new int[3];
a1[0]=-1;a1[1]=0;a1[2]=1;
if(!b.isSelected1()&&!b.isMarked()){
set(b);
for(int m=0;m<3;++m)
for(int n=0;n<3;++n){
int x=i+a[m];int y=j+a1[n];
if((x!=0||y!=0)&&MainClass.indexOut(x, y)){
if(!MainClass.button[x][y].isSelected1()&&
!MainClass.button[x][y].isMarked()){
if(MainClass.button[x][y].getContent()!=0)
set(MainClass.button[x][y]);
else
solveMine(MainClass.button[x][y]);
}
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -