📄 mb.java
字号:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class MB extends MIDlet implements CommandListener
{
private Display dis;
private Form frm1,frm2;
private Command cmdexit,cmdok,cmdback;
Ticker tick1,tick2;
public MB()
{
dis=Display.getDisplay(this);
frm1=new Form("MB");
frm2=new Form("back");
StringItem str1=new StringItem("hello word","");
frm1.append(str1);
cmdexit=new Command("Exit",Command.EXIT,2);
frm1.addCommand(cmdexit);
frm1.setCommandListener(this);
frm1.setTicker(tick1);
cmdok=new Command("OK",Command.OK,0);
frm1.addCommand(cmdok);
frm1.setCommandListener(this);
frm1.setTicker(tick1);
//dis.setCurrent(frm1);
StringItem str2=new StringItem("welcome to ","");
cmdback=new Command("Back",Command.BACK,1);
frm2.addCommand(cmdback);
frm2.addCommand(cmdexit);
frm2.setCommandListener(this);
frm2.setTicker(tick2);
dis.setCurrent( frm2);
}
public void commandAction(Command c, Displayable d)
{
if(c==cmdexit)
destroyApp(true);
else if(c==cmdok)
dis.setCurrent(frm2);
else if(c==cmdback)
dis.setCurrent(frm1);
}
public void startApp() throws MIDletStateChangeException
{
dis.setCurrent(frm1);
//dis.setCurrent(frm2);
}
public void destroyApp(boolean unconditional)
{
notifyDestroyed();
}
public void pauseApp()
{}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -