JavaMe连载(5)-绘制文本框TextEdit (八)

2014-11-24 07:56:21 · 作者: · 浏览: 9
rd.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,editor,username,passwd,passwd_re};
controller.handleEvent(UIController.EventID.EVENT_USER_REGIST_EDIT,args);
break;
}
default:;
}

keyCode = getGameAction(keyCode);
switch(keyCode)
{
case UP:
case LEFT:
{
currentlySelectedIndex--;
if(currentlySelectedIndex<0)
{
currentlySelectedIndex=0;
}
else
{
redraw();
}
break;
}
case DOWN:
case RIGHT:
{
currentlySelectedIndex++;
if(currentlySelectedIndex>2)
{
currentlySelectedIndex=2;
}
else
{
redraw();
}

break;
}
}
}

}
package com.token.view;

import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.game.GameCanvas;
import com.token.model.*;
import com.token.util.*;
import com.token.view.components.*;

public class UserRegist extends GameCanvas implements Runnable {

private UIController controller;
private Graphics graphics;

private Font ft;

private Menu menu;
private Head head;
private BackGroud backGroud;

private UserDataRecord userRecord;

private String title;

private TextEdit textEdit_name;
private TextEdit textEdit_passwd;
private TextEdit textEdit_passwd_re;
private int textEdit_name_x;
private int textEdit_name_y;
private int textEdit_passwd_x;
private int textEdit_passwd_y;
private int textEdit_passwd_re_x;
private int textEdit_passwd_re_y;
private int currentlySelectedIndex = 0;

private String username;
private String passwd;
private String passwd_re;

long caretBlinkDelay = 500L;
long lastCaretBlink = 0;
private String object_name;
private String editor;