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

📄 friendlist.java

📁 用自己写的j2me rms引擎写的电话本 功能是: 1.添加 2.查询 3.列出所有的资料 1.修改 2.删除 3.排序
💻 JAVA
字号:
/**
 * @(#)FriendList.java	
 * Copyright (c) 2004-2005 wuhua of workroom Inc. All Rights Reserved.
 * @version 	1.0, 10/05/2004
 * @author 	饶荣庆
 * @author 	
 */
package org.wuhua.photobook;

import java.util.Enumeration;
import java.util.Vector;

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

import org.wuhua.fuck.core.ResultSet;
import org.wuhua.fuck.core.SQLException;
import org.wuhua.photobook.model.Friend;
import org.wuhua.photobook.service.Service;

/**
 *此类的功能是用指定的方式排序用户。并把用户输出的列表上
 */
public class FriendList extends List implements CommandListener 
{
	private Display display = null;
	 
	public Command infoCommand = null;			
	public Command backCommand = null;	
	private String aString;
	private Menu menu;
	private Vector vectorFriend = null;
	private Enumeration enumerationVector;
	private Friend friend;
 
	private DetailInfoForm infoForm = new DetailInfoForm("详细信息");
	public FriendList(String s)
	{
		super(s, Choice.IMPLICIT);	 
		this.infoCommand = new Command("详细信息", Command.OK, 2);	
		this.backCommand = new Command("返回", Command.BACK, 2);
		this.addCommand(backCommand);
		this.addCommand(infoCommand);
		this.setCommandListener(this);
	}
	
	 

	public void showForm(Display display, Menu menu)	//用来显示界面
	{
	 
		this.display = display;
	   	this.menu = menu;
		this.display.setCurrent(this);
	}

	public void initList()
	{
	  
	}

	public void commandAction(Command c,Displayable s)
	{
		 if(c == this.backCommand){
			 this.display.setCurrent(menu);
		 }else{
			 Friend friend = new Friend();
			 ResultSet rs = Service.getInstance().find("select : friend : f_name:" + this.getString(this.getSelectedIndex()));
				try {
					while(rs.next()){
						 friend.setAddress(rs.getString(rs.getString("f_address")));
						 friend.setEMail(rs.getString(rs.getString("f_email")));
						 friend.setName(rs.getString(rs.getString("f_name")));
						 friend.setPhone(rs.getString(rs.getString("f_mobile")));
						
					}
				} catch (SQLException e) {
					// TODO 自动生成 catch 块
					e.printStackTrace();
			} 
			 infoForm.setFriend(friend);
			 infoForm.showForm(display, this);
		 }
	}
}



	
	

⌨️ 快捷键说明

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