sm.java
来自「非富多彩的十六个J2ME的例子」· Java 代码 · 共 74 行
JAVA
74 行
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class sm extends MIDlet implements CommandListener
{
private Display dis;
private Form frm1,frm2;
Ticker tick1,tick2;
Command cmdexit=new Command("Exit",Command.EXIT,1);
Command cmdok=new Command("Ok",Command.OK,0);
Command cmdback=new Command("Back",Command.BACK,2);
public sm()
{
}
public void commandAction(Command c, Displayable d)
{
if(c==cmdexit)
destroyApp(true);
else if(c==cmdok)
showform2();
else if(c==cmdback)
showform1();
}
public void startApp() throws MIDletStateChangeException
{
tick1=new Ticker("New Scheme for housing loans");
tick2=new Ticker("The expriy date of this scheme is August 24,2002");
dis=Display.getDisplay(this);
frm1=new Form("");
frm2=new Form("");
StringItem str1= new StringItem("Easy Loan-Happy Home","");
StringItem str2= new StringItem("Contact our nearset branch for further detials","");
frm1.append(str1);
frm2.append(str2);
frm1.addCommand(cmdexit);
frm1.addCommand(cmdok);
frm1.setCommandListener(this);
frm1.setTicker(tick1);
dis.setCurrent(frm1);
}
public void destroyApp(boolean unconditional)
{
notifyDestroyed();
}
public void pauseApp()
{
}
public void showform1()
{
frm1.addCommand(cmdexit);
frm1.addCommand(cmdok);
frm1.setCommandListener(this);
dis.setCurrent(frm1);
}
public void showform2()
{
frm2.addCommand(cmdexit);
frm2.addCommand(cmdback);
frm2.setCommandListener(this);
dis.setCurrent(frm2);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?