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);
}
}
[此贴子已经被作者于2010-12-12 18:33:50编辑过]