wall.java

来自「纯java编写的坦克大战游戏.把项目引入eclipse后立即可运行。在此基础上可」· Java 代码 · 共 28 行

JAVA
28
字号
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;


public class Wall {
	int x, y, w, h;

	public Wall(int x, int y, int w, int h) {
		super();
		this.x = x;
		this.y = y;
		this.w = w;
		this.h = h;
	}
	
	public void draw(Graphics g) {
		Color c = g.getColor();
		g.setColor(Color.DARK_GRAY);
		g.fillRect(x, y, w, h);
		g.setColor(c);
	}
	
	public Rectangle getRect() {
		return new Rectangle(x, y, w, h);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?