}
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);
}
}
}
}
package com.token.view;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.TextBox;
import com.token.util.UIController;
public class PopUpTextBox extends TextBox {
private UIController controller;
protected String canvasText = "";
private Command okCommand;
private Command cancelCommand;
private String object_name = null;
private String editor = null;
private Object args_t[];
private Object[] args;
public PopUpTextBox(UIController control, String title, String text, int maxsize, int constraints)
{
super(title, text, maxsize, constraints);
controller = control;
args = new Object[6];
okCommand = new Command("确定", Command.OK, 1);
cancelCommand = new Command("取消", Command.CANCEL, 1);
this.addCommand(okCommand);
this.addCommand(cancelCommand);
this.setCommandListener(new TextBoxListener());
}
public void init(Object[] args)
{
object_name = ((String)args[0]!=null) (String)args[0]:"";
editor = ((String)args[1]!=null) (String)args[1]:"";
//System.out.println(object_name);
//System.out.println(editor);
args_t = args;
this.setString("");
}
protected void closeTextBox(boolean update) {
if (update) canvasText = this.getString();
//System.out.println(canvasText);
if(object_name.equals("registScreen"))
{
if(editor.equals("regist_name"))
{
if(args_t[3]!=""||args_t[3]!=null||args_t[4]!=""||args_t[4]!=null)
{
args[0] = object_name;
args[1] = editor;
args[2] = this.canvasText;
args[3] = args_t[3];
args[4] = args_t[4];
}
controller.handleEvent(UIController.EventID.EVENT_USER_REGIST_EDIT_BACK,args);
}
else if(editor.equals("regist_passwd"))
{
if(args_t[2]!=""||args_t[2]!=null||args_t[4]!=""||args_t[4]!=null)
{
args[0] = object_name;
a