📄 setpassword.java
字号:
/** * <p>Title: CowriePixie</p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: xidian</p> * @author yangyong * @version 1.0 */import javax.microedition.lcdui.Alert;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.Item;import javax.microedition.lcdui.ItemStateListener;import javax.microedition.lcdui.List;import javax.microedition.rms.RecordStore;/* * 创建日期 2005-9-23 * * TODO 要更改此生成的文件的模板,请转至 * 窗口 - 首选项 - Java - 代码样式 - 代码模板 *//** * @author Administrator * * TODO 要更改此生成的类型注释的模板,请转至 * 窗口 - 首选项 - Java - 代码样式 - 代码模板 */public class SetPassword extends List implements CommandListener, ItemStateListener { private Display dis; private Command ok; private Command back; protected RecordStore ispswdb; // String ispassword=null;; /* (非 Javadoc) * @see javax.microedition.lcdui.CommandListener#commandAction(javax.microedition.lcdui.Command, javax.microedition.lcdui.Displayable) */ public SetPassword(Display display){ super("密码设置",List.IMPLICIT); dis = display; append(" 修改密码",Financing.img[4]); append(" 取消密码",Financing.img[4]); append(" 需要密码",Financing.img[4]); ok = new Command("选择", Command.OK, 2); addCommand(ok); back = new Command("退出", Command.BACK, 2); addCommand(back); setCommandListener(this); } /* (非 Javadoc) * @see javax.microedition.lcdui.CommandListener#commandAction(javax.microedition.lcdui.Command, javax.microedition.lcdui.Displayable) */ /* (非 Javadoc) * @see javax.microedition.lcdui.CommandListener#commandAction(javax.microedition.lcdui.Command, javax.microedition.lcdui.Displayable) */ public void commandAction(Command c, Displayable d) { if(c == back) { Main_Form mainform = new Main_Form(dis); dis.setCurrent(mainform); } if(c == ok) { int sel = getSelectedIndex(); switch(sel) { case 0: // '\0' ModifyPassword modifypassword = new ModifyPassword(dis); dis.setCurrent(modifypassword); break; case 1: // '\001' Financing.ispassword="false"; System.out.println(Financing.ispassword); UpdatePassword(); Alert a=new Alert("提示", " 取消密码登录成功",Financing.alert, AlertType.INFO); a.setTimeout(500); Main_Form mainform = new Main_Form(dis); dis.setCurrent(a,mainform); break; case 2: // '\002' Financing.ispassword="true"; System.out.println(Financing.ispassword); UpdatePassword(); Alert b=new Alert("提示", " 密码登录设置成功",Financing.alert, AlertType.INFO); b.setTimeout(500); Main_Form main = new Main_Form(dis); dis.setCurrent(b,main); break; // TODO 自动生成方法存根 } } } void UpdatePassword() { String filename = "ispsw"; byte psw[] = new byte[8]; try { ispswdb = RecordStore.openRecordStore(filename, true); } catch(Exception ex) { return; } try { byte temp[] = Financing.ispassword.getBytes(); ispswdb.setRecord(1, temp, 0,temp.length); } catch(Exception exception) { } try { ispswdb.closeRecordStore(); } catch(Exception exception1) { } } public void itemStateChanged(Item arg0) { // TODO 自动生成方法存根 }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -