?? 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 + -