exec.java

来自「在NETBEANS环境下」· Java 代码 · 共 52 行

JAVA
52
字号
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Graphics;
import javax.microedition.midlet.MIDlet;

public class Exec extends MIDlet {
	private Display display;

	public Exec() {
		display = Display.getDisplay(this);
	}

	public void startApp() {

		display.setCurrent(new DrawPanel());
	}

	public void pauseApp() {
	}

	public void destroyApp(boolean unconditional) {
	}
}

class DrawPanel extends Canvas {
	public void paint(Graphics g) {
		int width = getWidth() * 2 / 3;
		int left = getWidth() * 1 / 6;
		int height = getHeight() * 2 / 3;
		int top = getHeight() * 1 / 6;

		g.setColor(0, 0, 0);
		g.fillArc(left, top, width, height, 90, 180);

		g.setColor(255, 255, 0);
		g.fillArc(left, top, width, height, 270, 180);

		g.setColor(0, 0, 0);
		g.fillArc(left * 2, top * 3, width / 2, height / 2, 270, 180);

		g.setColor(255, 255, 0);
		g.fillArc(left * 2, top, width / 2, height / 2, 0, 360);

		g.setColor(255, 255, 0);
		g.fillArc(left * 2 + left * 3 / 4, top * 3 + top * 3 / 4, width / 8,
				height / 8, 0, 360);

		g.setColor(255, 0, 0);
		g.fillArc(left * 2 + left * 3 / 4, top + top * 3 / 4, width / 8,
				height / 8, 0, 360);
	}
}

⌨️ 快捷键说明

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