📄 egg.java
字号:
package com.bjsxt.snake;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
public class Egg {
private int row, col;
public int getCol() {
return col;
}
public void setCol(int col) {
this.col = col;
}
public int getRow() {
return row;
}
public void setRow(int row) {
this.row = row;
}
public Egg(int row, int col) {
this.row = row;
this.col = col;
}
public void draw(Graphics g) {
Color c = g.getColor();
g.setColor(Color.RED);
g.fillOval(col*Yard.BLOCK_SIZE, row*Yard.BLOCK_SIZE, Yard.BLOCK_SIZE, Yard.BLOCK_SIZE);
g.setColor(c);
}
public Rectangle getRect() {
return new Rectangle(col*Yard.BLOCK_SIZE, row*Yard.BLOCK_SIZE, Yard.BLOCK_SIZE, Yard.BLOCK_SIZE);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -