⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 egg.java

📁 用java开发的贪吃蛇程序
💻 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 + -