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

2014-11-24 07:56:21 · 作者: · 浏览: 2
rgs[1] = editor;
args[2] = args_t[2];
args[3] = this.canvasText;
args[4] = args_t[4];
}
controller.handleEvent(UIController.EventID.EVENT_USER_REGIST_EDIT_BACK,args);
}
else if(editor.equals("regist_passwd_re"))
{
if(args_t[2]!=""||args_t[2]!=null||args_t[3]!=""||args_t[3]!=null)
{
args[0] = object_name;
args[1] = editor;
args[2] = args_t[2];
args[3] = args_t[3];
args[4] = this.canvasText;
}
controller.handleEvent(UIController.EventID.EVENT_USER_REGIST_EDIT_BACK,args);
}
}

//...
}

private class TextBoxListener implements CommandListener
{
public void commandAction(Command command, Displayable disp)
{
if(command==okCommand)
{
closeTextBox(true);
}
else if(command==cancelCommand)
{
closeTextBox(false);
}
}
}
}


UserRegist.java

[html] 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;
private boolean cursorBlinkOn1;
private boolean cursorBlinkOn2;
private boolean cursorBlinkOn3;

private int width;
private int height;

public UserRegist(UIController control)
{
super(false);
this.controller=control;
this.title = "用户注册";
setFullScreenMode(true);
graphics = getGraphics();

width = getWidth();
height = getHeight();

menu = new Menu(this);
head = new Head(this);
backGroud = new BackGroud(this);

userRecord = new UserDataRecord();

textEdit_name = new TextEdit(this);
textEdit_passwd = new TextEdit(this);
textEdit_passwd_re = new TextEdit(this);
}

public void show(Object[] args) {
// TODO Auto-generated method stub
setFullScreenMode(true);

object_name = ((String)args[0]!=null) (String)args[0]:"";
editor = ((String)args[1]!=null) (String)args[1]:"";
username = ((String)args[2]!=null) (String)args[2]:"";
passwd = ((String)a