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

📄 welcome.java

📁 非富多彩的十六个J2ME的例子
💻 JAVA
字号:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class welcome extends MIDlet implements CommandListener
{
     Display dis;
     Form frm1,frm2;
     Ticker tick1,tick2;
     static final Command  okcommand=new Command("Ok",Command.OK,1);
     static final Command backcommand=new Command("Back",Command.BACK,0);
     static final Command exitcommand=new Command("Exit",Command.EXIT,2);
     
     public welcome()
     {
     	
     }
     
     
     public void startApp() throws MIDletStateChangeException
     {
        tick1=new Ticker("Good Morning");
        tick2=new Ticker("Quotable Quotes");
        dis=Display.getDisplay(this);
        frm1=new Form("World");
        frm2=new Form("Education");
        StringItem str1=new StringItem("Welcome to this session","");
        StringItem str2=new StringItem("Working together Works","");
        frm1.addCommand(exitcommand);
        frm1.addCommand(okcommand);
        frm1.append(str1);
        frm2.addCommand(okcommand);
        frm2.addCommand(backcommand);
        frm2.append(str2);
        frm1.setTicker(tick1);
        frm2.setTicker(tick2);
        frm1.setCommandListener(this);
        dis.setCurrent(frm1);
        
        	
     	
     }
     public void pauseApp()
     {
     	
     }
     
    public void destroyApp(boolean unconditional) 
     {
        notifyDestroyed();	
     	
     }
     
     public void showform1()
     {
        frm1.addCommand(exitcommand);
        frm1.addCommand(okcommand);
        frm1.setCommandListener(this);
         dis.setCurrent(frm1);	
     	
     }
     
     public void showform2()
     {
         frm2.addCommand(exitcommand);
         frm2.addCommand(backcommand);
         frm2.setTicker(tick2);
         frm2.setCommandListener(this);
        dis.setCurrent(frm2);	
     	
     }
     
     public void commandAction(Command cmd,Displayable  displayable)
     {
         String lable=cmd.getLabel();
         if(lable.equals("Exit"))
         {
            destroyApp(true);	
         }	
         
         else if (lable.equals("Back"))
         {
             showform1();	
         }
         
         else 
         {
            showform2();	
          	
         }
     }
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -