日期:2014-05-20 浏览次数:20662 次
public class PasswordModifyForm extends Form implements CommandListener { // -------信息提示 private String msg = ""; private int pos; private static PasswordModifyForm instance; private static TextField newPassword = null; private static TextField newPasswordTwo = null; private static Command ok = new Command("确定", 4, 1); private static Command back = new Command("返回", 2, 1); private PasswordModifyForm() { super(" "); // 请输入描述信息 newPassword = new TextField("输入密码", "", 12, 0); newPasswordTwo = new TextField("再输一次", "", 12, 0); append(newPassword); append(newPasswordTwo); addCommand(ok); addCommand(back); setCommandListener(this); } public static PasswordModifyForm getInstance() { if (instance == null) instance = new PasswordModifyForm(); return instance; } public void commandAction(Command c, Displayable d) { String newp = "", newPTwo = ""; newp = newPassword.getString(); newPTwo = newPasswordTwo.getString(); if (c == ok) { synchronized (this) { // -----密码 if (DateTool.isEmpty(newp) || DateTool.isEmpty(newPTwo)) { // ----密码不能为空 msg = "密码不能为空!"; StringItem si = new StringItem(msg, ""); pos = this.append(si); // ---------- Timer timer = new Timer(); timer.schedule(new TimerTask() { public void run() { if (!DateTool.isEmpty(msg)) { delete(pos); msg = ""; } } }, 500); } } } else if (c == back) { App.showBefore(); } } }