📄 line_stroke_midlet.java
字号:
package ch05;
import java.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class Line_Stroke_MIDlet
extends MIDlet
implements CommandListener {
//声明一个实现绘制的Canvas类对象
private Line_Stroke_Canvas lsc;
/*
1.启动应用程序
*/
public void startApp() {
if (lsc == null) {
try {
lsc = new Line_Stroke_Canvas();
Display.getDisplay(this).setCurrent(lsc);
Command exitCommand = new Command("退出", Command.EXIT, 0);
lsc.addCommand(exitCommand);
lsc.setCommandListener(this);
//启动绘制图形
lsc.start();
}
catch (IOException ioe) {
System.out.println(ioe);
}
}
}
//挂起应用程序
public void pauseApp() {
}
//撤消应用程序
public void destroyApp(boolean unconditional) {
}
/*
2.响应按钮事件
*/
public void commandAction(Command c, Displayable s) {
if (c.getCommandType() == Command.EXIT) {
destroyApp(true);
notifyDestroyed();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -