📄 addentryui.java
字号:
/*
* AddEntryUI.java
*
* Created on 2006年3月17日, 上午10:13
*
* To change this template, choose Tools | Options and locate the template under
* the Source Creation and Management node. Right-click the template and choose
* Open. You can then make changes to the template in the Source Editor.
*/
package com.j2medev.sample.phonebook;
import javax.microedition.lcdui.*;
/**
*
* @author Admin
*/
public class AddEntryUI extends Form implements CommandListener{
private Controller controller;
private Command ok = new Command("确定",Command.OK, 0);
private Command cancel = new Command("返回",Command.CANCEL, 1);
private TextField name = new TextField("姓名", null, 10, TextField.ANY);
private TextField mobile = new TextField("手机号", null, 11, TextField.NUMERIC);
private TextField phone = new TextField("固定电话", null, 15, TextField.NUMERIC);
private TextField email = new TextField("电子邮件", null, 20, TextField.ANY);
private TextField address = new TextField("住址",null, 20, TextField.ANY);
private TextField qq = new TextField("QQ号", null, 15, TextField.NUMERIC);
/** Creates a new instance of AddEntryUI */
public AddEntryUI(Controller controller) {
super("添加联系人");
this.controller = controller;
append(name);
append(mobile);
append(phone);
append(email);
append(address);
append(qq);
addCommand(ok);
addCommand(cancel);
setCommandListener(this);
}
public void clear(){
name.setString("");
mobile.setString("");
phone.setString("");
email.setString("");
address.setString("");
qq.setString("");
}
public void commandAction(Command cmd, Displayable d){
if(cmd == cancel){
controller.handleCommand(controller.SHOW_LIST_BACK, null);
}
if(cmd == ok){
Entry e = new Entry(name.getString(), mobile.getString(), phone.getString(),
email.getString(), address.getString(), qq.getString());
controller.handleCommand(controller.DO_ADD_ENTRY, new Object[] {e});
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -