⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 detailui.java

📁 J2ME实现的手机电话本
💻 JAVA
字号:
/*
 * DetailUI.java
 *
 * Created on 2006年3月17日, 上午10:14
 *
 * 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 DetailUI extends Form implements CommandListener{
    private Controller controller;
    private Entry entry = null;
    private Command back = new Command("返回主菜单",Command.BACK, 0);
    private Command edit = new Command("编辑",Command.ITEM, 1);
    private Command delet = new Command("删除",Command.ITEM, 2);
    private StringItem name = new StringItem("姓名:","");
    private StringItem mobile = new StringItem("手机:","");
    private StringItem phone = new StringItem("电话:","");
    private StringItem email = new StringItem("电子邮箱:","");
    private StringItem address = new StringItem("住址:","");
    private StringItem qq = new StringItem("QQ号:","");
    
    /** Creates a new instance of DetailUI */
    public DetailUI(Controller controller) {
        super("联系人详细信息");
        this.controller = controller;
        append(name);
        append(mobile);
        append(phone);
        append(email);
        append(address);
        append(qq);
        addCommand(back);
        addCommand(edit);
        addCommand(delet);
        setCommandListener(this);
    }
    public void load(Entry entry){
        //System.out.println("执行到这儿了");
        this.entry = entry;
        name.setText(entry.getName());
        mobile.setText(entry.getMobile());
        phone.setText(entry.getPhone());
        email.setText(entry.getEmail());
        address.setText(entry.getAddress());
        qq.setText(entry.getQQ());
        //System.out.println(entry.getName());
        
    }
    public void commandAction(Command cmd,Displayable d){
        if(cmd == back){
            controller.handleCommand(controller.SHOW_LIST_BACK, null);
        }
        if(cmd == edit){
            controller.handleCommand(controller.SHOW_EDIT_ENTRY, new Object[] {name.getText()});
        }
        if(cmd == delet){
            controller.handleCommand(controller.DO_DELETE_ENTRY, new Object[] {name.getText()});
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -