📄 simplemidlet.java
字号:
package com.j2medev.chapter2;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
import java.io.*;
public class SimpleMIDlet extends MIDlet implements CommandListener {
private Display display = null;
private Command exitCommand = new Command("退出", Command.EXIT, 0);
public void startApp() {
display = Display.getDisplay(this);
Form mainForm = new Form("simple");
Image img = null;
try{
img = Image.createImage("/JavaPowered.png");
}catch(IOException ex){
ex.printStackTrace();
}
if(img != null)
mainForm.append(img);
mainForm.addCommand(exitCommand);
mainForm.setCommandListener(this);
display.setCurrent(mainForm);
}
public void pauseApp () {}
public void destroyApp(boolean unconditional) {}
public void commandAction(Command cmd, Displayable s) {
if (cmd==exitCommand)
notifyDestroyed();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -