?? block.java~8~
字號:
package diamonds3;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Block {
int x,y; //方塊的位置
int color; //方塊的顏色
public Block(int x,int y,int c) {
this.x=x; this.y=y; this.color=c;
}
public void setBlock(int x, int y, int c) {
this.x = x;
this.y = y;
this.color = c;
}
public boolean equals(Block obj) {
//重寫該方法,判斷方塊是否相同
return x==obj.x && y==obj.y && color==obj.color;
}
public boolean isInRange(Panel pnl) {
//自定義方法,判斷方塊是否在有效范圍內 80<= x <=240 20<=y<240
//System.out.println(x+y);
return x>=80 && x<=240 && y>=20 && y<=240;
}
public int getI(Panel pnl){return (x-80)/20;}
public int getJ(Panel pnl){return (y-20)/20;}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -