(int m, int n)
| 208 | } |
| 209 | /*绘制掉落后方块图像*/ |
| 210 | public void draw(int m, int n) { |
| 211 | int temp = 0x8000;//表示1000 0000 0000 0000 |
| 212 | for (int i = 0; i < 4; i++) {//循环遍历16个方格(4*4) |
| 213 | for (int j = 0; j < 4; j++) { |
| 214 | if ((temp & rect) != 0) {// 此处有方块时 |
| 215 | grids[m][n].setBackground(Color.GREEN);//有方块的地方变为绿色 |
| 216 | } |
| 217 | n++;//下一列 |
| 218 | temp >>= 1; |
| 219 | } |
| 220 | m++;//下一行 |
| 221 | n = n - 4;//回到首列 |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | @Override |
| 226 | public void keyPressed(KeyEvent e) { |
no outgoing calls
no test coverage detected