rectangle.java

来自「J2ME的手机小游戏,自己的毕业设计的程序」· Java 代码 · 共 57 行

JAVA
57
字号
import javax.microedition.lcdui.Graphics;
/*
 * 地图上的场景,方块,长条等等
 * */
public class Rectangle {
	
	int x, y, w, h;
	boolean fd = false;


	public Rectangle(int x,int y,int w,int h,boolean fd)
	
	{
		this.x = x;
		this.y = y;
		this.w = w;
		this.h = h;
		this.fd = fd;
	}

	public void draw(Graphics g, int x, int y, int w, int h, boolean fd) 
	{
		this.x = x;
		this.y = y;
		this.w = w;
		this.h = h;
		this.fd = fd;
		if (fd)
			g.fillRect(this.x, this.y, this.w, this.h);//实心物体
		else
			g.drawRect(this.x, this.y, this.w, this.h);//空心物体
	}

	public int getX()
	
	{
		return x;
	}

	public int getY() 
	{
		return y;
	}

	public int getW() 
	
	{
		return w;
	}

	public int getH() 
	{
		return h;
	}

}

⌨️ 快捷键说明

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