block.java
来自「简单的贪吃蛇源码」· Java 代码 · 共 32 行
JAVA
32 行
import java.awt.*;
import java.awt.event.KeyEvent;
public class Block {
public static final int BLOCKWH = 20;
int x ,y ;
private Color c;
public Block(int x,int y,Color c){
this.x = x;
this.y = y;
this.c = c;
}
public void Draw(Graphics g){
Color tmpc = g.getColor();
g.setColor(c);
g.fillRect(x, y, BLOCKWH, BLOCKWH);
g.setColor(tmpc);
}
public Rectangle getRect() {
return new Rectangle(x, y, BLOCKWH , BLOCKWH);
}
public Color getC() {
return c;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?