⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sm.java

📁 非富多彩的十六个J2ME的例子
💻 JAVA
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -