www.pudn.com > phonebk.rar > SearchUI.java


/* 
 * SearchUI.java 
 *查找页面 
 * Created on 2006年3月19日, 下午10:15 
 * 
 * To change this template, choose Tools | Options and locate the template under 
 * the Source Creation and Management node. Right-click the template and choose 
 * Open. You can then make changes to the template in the Source Editor. 
 */ 
 
package com.j2medev.sample.phonebook; 
 
import javax.microedition.lcdui.*; 
/** 
 * 
 * @author Admin 
 */ 
public class SearchUI extends Form implements CommandListener{ 
    private Controller controller; 
    private TextField searchname = new TextField("输入姓名:", "", 20, TextField.ANY); 
    private Command searchCommand = new Command("查找",Command.OK, 0); 
    private Command backCommand = new Command("返回",Command.BACK, 1);     
     
    /** Creates a new instance of SearchUI */ 
    public SearchUI(Controller controller) { 
        super("查找联系人"); 
        this.controller = controller; 
        append(searchname); 
        addCommand(searchCommand); 
        addCommand(backCommand); 
        setCommandListener(this); 
    } 
    public void commandAction(Command cmd, Displayable d){ 
      if(cmd == backCommand){ 
          controller.handleCommand(controller.SHOW_LIST_BACK,null); 
      } 
      if(cmd == searchCommand){ 
           
          controller.handleCommand(controller.SHOW_LIST1_ENTRY, new Object[] {searchname.getString()}); 
      } 
    } 
     
}