📄 firstmidlet.java
字号:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class FirstMIDlet extends MIDlet implements CommandListener {
protected void startApp() {
Display display = Display.getDisplay(this);
TextBox text = new TextBox("第一个MIDlet",
"我们开始学是MIDP编程!", 127, TextField.ANY);
Command cmdExit = new Command("退出", Command.EXIT, 0);
text.addCommand(cmdExit);
text.setCommandListener(this);
display.setCurrent(text);
}
protected void pauseApp() {
}
protected void destroyApp(boolean undicational) {
}
//当用户触发“退出”命令时,系统会自动调用这个方法
public void commandAction(Command cmd, Displayable d) {
if(cmd.getCommandType() == Command.EXIT) {
notifyDestroyed();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -