📄 midlet3.java
字号:
package prj3_1;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class MIDlet3 extends MIDlet implements CommandListener{
private Form frm = new Form("请您选择相应操作");
private Display dis;
private Command cmdDel = new Command("删除该号码",Command.SCREEN,1);
private Command cmdEdit = new Command("编辑该号码",Command.SCREEN,1);
private Command cmdExit = new Command("退出程序",Command.SCREEN,1);
private Command cmdBack = new Command("返回",Command.BACK,1);
public MIDlet3() {
// TODO Auto-generated constructor stub
}
protected void startApp() throws MIDletStateChangeException {
// TODO Auto-generated method stub
dis = Display.getDisplay(this);
dis.setCurrent(frm);
frm.addCommand(cmdDel);
frm.addCommand(cmdEdit);
frm.addCommand(cmdExit);
frm.addCommand(cmdBack);
frm.setCommandListener(this);
}
public void commandAction(Command c,Displayable d){
if(c==cmdDel || c==cmdEdit){
frm.append(c.getLabel());
}
else if(c==cmdExit){
this.notifyDestroyed();
}
else{
frm.setTitle("返回");
}
/*另一种方法
if(c.getLabel().equals("删除该号码")){
}.....
*/
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
// TODO Auto-generated method stub
}
protected void pauseApp() {
// TODO Auto-generated method stub
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -