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

📄 detailinfoui.java

📁 这是我们学校教的j2me程序开发实例从入门到精通自带关盘的源代码
💻 JAVA
字号:
/*
 * Created on 2004-7-12
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.north.phonebook.ui;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.List;

import com.north.phonebook.model.Account;

/**
 * @author P2800
 * 
 * TODO To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Style - Code Templates
 */
public class DetailInfoUI extends List implements CommandListener
{

    private UIController uicontroller;
    private int listNum = 0;
    public static final Command backCommand = new Command("返回", Command.BACK, 1);

    public DetailInfoUI(UIController uicontroller)
    {
        super(Title.DETAIL_INFO, List.IMPLICIT);
        this.uicontroller = uicontroller;
        this.addCommand(backCommand);
        this.setCommandListener(this);
    }

    public void init(Account account)
    {
        if (listNum > 0)
        {
            deleteAll(listNum);
        }
        this.append(account.getUserName(), null);
        this.append(account.getMobilePhone(), null);
        String email = account.getEmail();
       
        if (email.length()!=0)
        {
            this.append(email, null);
            System.out.println(email.length());
        }
        String phone = account.getPhone();
        if (phone.length()!=0)
        {
            this.append(phone, null);
            System.out.println(phone+"is");
        }
        
        listNum = size();

    }

    public void deleteAll(int listNum)
    {
        for (int i = listNum - 1; i >= 0; i--)
        {
            this.delete(i);
        }
    }

    /*
     * (non-Javadoc)
     * 
     * @see javax.microedition.lcdui.CommandListener#commandAction(javax.microedition.lcdui.Command,
     *      javax.microedition.lcdui.Displayable)
     */
    public void commandAction(Command arg0, Displayable arg1)
    {
        // TODO Auto-generated method stub
        if (arg0 == backCommand)
        {
            uicontroller
                    .handleEvent(UIController.EventID.EVENT_DETAIL_BACK_LIST);
        }

    }

}

⌨️ 快捷键说明

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