for(int i=0; i
graphics.drawString(info_wrap2[i],5, (i+info_wrap1.length) * ft.getHeight()+textEdit_name.height+margin+40, Graphics.TOP|Graphics.LEFT);
}
textEdit_passwd_x = 5;
textEdit_passwd_y = (info_wrap1.length+info_wrap2.length) * ft.getHeight()+textEdit_name.height+margin+40;
textEdit_passwd.drawTextBox(this, graphics, passwd, textEdit_passwd_x, textEdit_passwd_y, cursorBlinkOn2);
info = "密码确认:\n";
String info_wrap3[] = StringDealMethod.format(info, width-10, ft);
graphics.setFont(ft);
graphics.setColor(Color.text);
for(int i=0; i
graphics.drawString(info_wrap3[i],5, (i+info_wrap1.length+info_wrap2.length) * ft.getHeight()+textEdit_name.height+textEdit_passwd.height+2*margin+40, Graphics.TOP|Graphics.LEFT);
}
textEdit_passwd_re_x = 5;
textEdit_passwd_re_y = (info_wrap1.length+info_wrap2.length+info_wrap3.length) * ft.getHeight()+textEdit_name.height+textEdit_passwd.height+2*margin+40;
textEdit_passwd_re.drawTextBox(this, graphics, passwd_re, textEdit_passwd_re_x, textEdit_passwd_re_y, cursorBlinkOn3);
}
public void clearScreen()
{
graphics.setColor(0xff,0xff,0xff);
graphics.fillRect(0, 0, width, height);
}
public void checkTimeStamp()
{
long currentTime = System.currentTimeMillis();
//System.out.println("1");
if(lastCaretBlink + caretBlinkDelay < currentTime)
{
//System.out.println("2");
if(editor.equals("regist_name"))
{
cursorBlinkOn1 =! cursorBlinkOn1;
cursorBlinkOn2 = false;
cursorBlinkOn3 = false;
}
else if(editor.equals("regist_passwd"))
{
cursorBlinkOn1 = false;
cursorBlinkOn2 =! cursorBlinkOn2;
cursorBlinkOn3 = false;
}
else if(editor.equals("regist_passwd_re"))
{
cursorBlinkOn1 = false;
cursorBlinkOn2 = false;
cursorBlinkOn3 =! cursorBlinkOn3;
}
lastCaretBlink = currentTime;
}
}
public void run()
{
//System.out.println("run");
while(true)
{
checkTimeStamp();
redraw();
try
{
synchronized(this)
{
//System.out.println("3");
wait(50L);
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
protected void keyPressed(int keyCode)
{
switch(keyCode)
{
case KeyID.SOFT_RIGHT:
{
controller.handleEvent(UIController.EventID.EVENT_EXIT,null);
break;
}
case KeyID.SOFT_LEFT:
{
if(username!="" && passwd!=""&&passwd_re!="")
{
if(passwd.equals(passwd_re))
{
userRecord.db_deleteAllRecord();
if(userRecord.db_getRecord(1)==null)
{
UserDataItem userItem = new UserDataItem(1,(username+","+passwd).getBytes());
userRecord.db_addRecord(userItem);
userItem = null;
System.gc();
}
String update = "start";
Object [] args = {"activeScreen", null, update};
controller.handleEvent(UIController.EventID.EVENT_NEXT_ACTIVE_TOKEN_SCREEN,args);
}
}
break;
}
case KeyID.KEY_EDIT:
case KEY_NUM0:
case KEY_NUM1:
case KEY_NUM2:
case KEY_NUM3:
case KEY_NUM4:
case KEY_NUM5:
case KEY_NUM6:
case KEY_NUM7:
case KEY_NUM8:
case KEY_NUM9:
{
//System.out.println(editor);
Object[] args = {object_name,edit