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

📄 loginform.java

📁 J2ME编的手机助手 文件下载解压缩以后,是一个NetBeans的工程文件,如果有NB的朋友,可以直接打开编辑 源文件在src目录下面,可执行文件在dist目录下 功能如下 1
💻 JAVA
字号:
/*
 * LoginForm.java
 *
 * Created on 2007年3月11日, 下午4:13
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package net.bccn.account.ui;

import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;
import net.bccn.account.model.MySet;
import net.bccn.account.util.Record;
import net.bccn.account.util.Util;

/**
 *
 * @author hadeslee
 */
public class LoginForm extends Form implements CommandListener{
    private Display dis;
    private MySet my;
    private TextField pwd;
    private Command ok,cancel;
    /** Creates a new instance of LoginForm */
    public LoginForm(Display dis) {
        super("登录");
        this.dis=dis;
    }
    //检查一下是否需要密码,如果不需要,则直接进入主画面
    public void check(){
        Record[] rds=Util.getAllRecords(new MySet());
        if(rds!=null&&rds.length>0){
            my=(MySet)rds[0];
        }
        if(my==null||!my.getIsPwd()){
            dis.setCurrent(MainForm.getInstance());
            Util.main.isStart=true;
        }else{
            pwd=new TextField("请输入密码",null,8,TextField.PASSWORD);
            this.append(pwd);
            ok=new Command("确定",Command.OK,1);
            cancel=new Command("退出",Command.EXIT,0);
            this.addCommand(ok);
            this.addCommand(cancel);
            this.setCommandListener(this);
            dis.setCurrent(this);
        }
    }

    public void commandAction(Command command, Displayable displayable) {
        if(command==ok){
            String p=pwd.getString();
            if(p==null||!p.equals(my.getPwd())){
                Util.showINFO(AlertType.ERROR,"您的密码有误!!");
                pwd.setString(null);
            }else{
                dis.setCurrent(MainForm.getInstance());
                Util.main.isStart=true;
            }
        }else if(command==cancel){
            Util.main.destroyApp(true);
            Util.main.notifyDestroyed();
        }
    }
}

⌨️ 快捷键说明

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