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

📄 prj43.java

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


public class prj43 extends MIDlet implements CommandListener
{
    Display dis;
    Form frm=new Form("Service calls");
    List menu;
    StringItem str=new StringItem("1.Call 1\n" + "2. Call 2\n"+"3. Call    3\n" +"4. Call 4 \n",null);
    Command cmdok=new Command("Ok",Command.OK,1);
    Command cmdback=new Command("Back",Command.BACK,0);	
    Command cmdexit=new Command("Exit",Command.STOP,2);
    String currentMenu;
    
    public prj43()
    {
    	
    }
    
    public void startApp() throws MIDletStateChangeException
    {
       dis=Display.getDisplay(this);
       menu=new List("Service calls",Choice.IMPLICIT);
       menu.append("View",null);
       menu.append("Update status",null);
       menu.addCommand(cmdexit);
       menu.setCommandListener(this);
       mainmenu();
       frm.append(str);
    	
    }
	
	public void mainmenu()
	{
	  dis.setCurrent(menu);
	  currentMenu="Main";	
	}
	
	public void pauseApp()
	{
	   frm=null;
	   dis=null;
	   menu=null;
	   str=null;	
		
	}
	
	public void destroyApp(boolean b)
	{
	    notifyDestroyed();	
	}
	
	public void showform()
	{
		frm.addCommand(cmdback);
		frm.setCommandListener(this);
		dis.setCurrent(frm);
		currentMenu="frm";
		
	}
	
	public void commandAction(Command c,Displayable d)
	{
	   try
	   {
	   	   if(c==cmdexit)
	   	     destroyApp(true);
	   	   else if(c==cmdback)
	   	      mainmenu();
	   	   else
	   	   {
	   	   	 List down=(List)dis.getCurrent();
	   	   	 switch(down.getSelectedIndex())
	   	   	 {
	   	   	   case 0: showform();
	   	   	          break;
	   	   	          
	   	   	   case 1: showform();
	   	   	          break;	
	   	   	 	
	   	   	 }
	   	    	
	   	   }
	   	
	   	}
	   	
	   	catch(Exception e)
	   	{
	   		
	    }	
		
	}
}

⌨️ 快捷键说明

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