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

📄 gui.java

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

public class gui extends MIDlet implements CommandListener
{
    Display dis;
    Form frm=new Form("Container Form");
    List menu;
    TextBox input;
    Gauge gauge=new Gauge("Your enquiry is being processed",false,10,3);
    
    Command cmdexit=new Command("Exit",Command.EXIT,2);
    Command cmdok=new Command("Ok",Command.OK,1);
    Command cmdback=new Command("Back",Command.BACK,0);
    String currentMenu;
    
    public gui()
    {
    	
    }
    
    public void startApp() throws MIDletStateChangeException
    {
    	dis=Display.getDisplay(this);
    	menu=new List("Enquiries",Choice.IMPLICIT);
    	menu.append("Current Balance",null);
    	menu.append("Fixed Deposit",null);
    	menu.append("Check Status",null);
    	
    	menu.addCommand(cmdexit);
    	menu.setCommandListener(this);
    	mainmenu();
    	frm.append(gauge);
    	
    }
    
    
    
    public void mainmenu()
    {
       dis.setCurrent(menu);
       currentMenu="Main";	
    	
    }
    
     
    public void pauseApp()
    {
    	frm=null;
    	dis=null;
    	menu=null;
    	input=null;
    	gauge=null;
    }
    
    public void destroyApp(boolean unconditinal ) 
    {
    	
      notifyDestroyed();	
    }
   
    
    public void showtextbox()
    {
        input=new TextBox("Enter the Check Number:","",20,TextField.ANY);
        input.addCommand(cmdback);
        input.addCommand(cmdok);
        input.setCommandListener(this);
        input.setString("");
        dis.setCurrent(input);
        currentMenu="input";
    }
    
    public void showform()
    {
       frm.addCommand(cmdback);
       //frm.addCommand(cmdok);
       frm.setCommandListener(this);
       dis.setCurrent(frm);
       currentMenu="frm";	
    	
    }
    
    
    public void commandAction(Command c,Displayable d) 
    {
   
    	if(c==cmdexit)
    	{
    	  destroyApp(true);
    	}
     
    	else if(c==cmdback)
    	{
    	   if(currentMenu.equals("input")||currentMenu.equals("frm"))
    	   {
    	       mainmenu();	
    	   	
    	   }	
    	}
    	
    	else
    	{
    	    if(c==cmdok)
    	    {
    	    	
    	       showform();	
    	    }
    	    
    	    else
    	    {
    	       List down=(List)dis.getCurrent();
    	       switch(down.getSelectedIndex())
    	       {
    	           case 0: showform();
    	                break;
    	                
    	           case 1: showform();
    	                 break;
    	                 
    	           case 2: showtextbox();
    	                 break;	
    	       	
    	       }	
    	    	
    	    }	
    		
    	}
   	
      
    }	
	
}

⌨️ 快捷键说明

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