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


/* 
 * PsaasetUI.java 
 *密码设置页面 
 * Created on 2006年3月23日, 上午10:17 
 * 
 * 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 PassetUI extends Form implements CommandListener{ 
    private Controller controller; 
    private TextField olduser= new TextField("旧用户:", "", 20, TextField.NUMERIC); 
    private TextField oldpass = new TextField("旧密码:", "", 20, TextField.NUMERIC | TextField.PASSWORD); 
    private TextField newuser= new TextField("新用户:", "", 20, TextField.NUMERIC); 
    private TextField newpass= new TextField("新密码:", "", 20, TextField.NUMERIC | TextField.PASSWORD); 
    private ChoiceGroup autologin = new ChoiceGroup("设置",Choice.MULTIPLE, new String[] {"记住密码并自动登录"}, null); 
    private Command ok = new Command("确定",Command.OK, 1); 
    private Command exit = new Command("退出",Command.EXIT, 2); 
     /** Creates a new instance of PsaasetUI */ 
    public PassetUI(Controller controller) { 
        super("密码设置"); 
        this.controller = controller; 
        append(olduser); 
        append(oldpass); 
        append(newuser); 
        append(newpass); 
        append(autologin); 
        addCommand(ok); 
        addCommand(exit); 
        setCommandListener(this); 
         
         
    } 
    public void commandAction(Command cmd , Displayable d){ 
        if(cmd == ok){ 
            String autoflg = null; 
            String _olduser = olduser.getString(); 
            String _oldpass = oldpass.getString(); 
            String _newuser = newuser.getString(); 
            String _newpass = newpass.getString(); 
            boolean _auto = autologin.isSelected(0); 
            if(_auto == true){ 
                autoflg = "1"; 
            }else{ 
                autoflg = "0"; 
            } 
            controller.handleCommand(Controller.DO_PASSSET_ENTRY, new Object[] {_olduser,_oldpass,_newuser,_newpass,autoflg}); 
        } 
        if(cmd == exit){ 
            controller.handleCommand(controller.SHOW_LIST_BACK, null); //返回到主菜单 
        } 
    } 
     
}