📄 608d7cf44899001b138cd89f505b592c
字号:
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class SimpleGraphic extends MIDlet implements CommandListener {
private Command exitCommand;
private SimpleGraphicCanvas sg;
public SimpleGraphic() {
exitCommand = new Command("Exit", Command.EXIT, 1);
sg = new SimpleGraphicCanvas();
sg.addCommand(exitCommand);
sg.setCommandListener(this);
Display.getDisplay(this).setCurrent(sg);
}
public void commandAction(Command c, Displayable d) {
if (c == exitCommand) {
destroyApp(false);
notifyDestroyed();
}
}
}
class SimpleGraphicCanvas extends Canvas{
protected void paint(Graphics g) {
//绘制直线
g.drawLine(0,0,150,150);
//绘制矩形
g.fillRect(150,100,40,40);
//绘制填充矩形
g.drawRect(80,60,50,80)
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -