JAVA帮忙修改下,小弟先谢了
这是一个基于J2ME的实现手机电话簿功能的程序,有错误,求帮忙修改下,时间很急的.
这是我做的毕业设计,我是学的自动化,却毕业设计做JAVA的 ,比较郁闷
请修改的详细点,或者哪位有电话簿的程序,请贴出来,小弟多谢了,解决问题即给分!
import javax.microedition.lcdui.*;
public class DetailInfo extends Form implements CommandListener
{
private Display display;
private Displayable parent;
private Command backCommand
= new Command("BACK",Command.BACK,1);
private Command deleteCommand
= new Command("Delete",Command.SCREEN,2);
private Command modifyCommand
= new Command("Modify",Command.SCREEN,2);
private StringItem idItem,nameItem,phoneItem;
private PhoneBook pb;
private String stringID;
private int id;
private Friend friend;
private int _id;
private String _name,_phone;
public DetailInfo(Display d,Displayable p,String idAndName)
{
super("Detail Info");
display = d;
parent = p;
addCommand(backCommand);
addCommand(deleteCommand);
addCommand(modifyCommand);
setCommandListener(this);
pb = new PhoneBook();
//get id from idAndName
stringID = idAndName.substring(0,2);
id = Integer.parseInt(stringID);
friend = pb.getFriend(id);
_id = friend.getID();
_name = friend.getName();
_phone = friend.getPhone();
idItem = new StringItem("ID:",_id + "");
nameItem = new StringItem("Name:",_name);
phoneItem = new StringItem("phone:",_phone);
append(idItem);
append(nameItem);
append(phoneItem);
}
public void commandAction(Command c,Displayable s)
{
if(c.getLabel() =="BACK")
{
display.setCurrent(parent);
}
else if(c.getLabel() == "Delete")
{
DeleteFriendForm dff
= new DeleteFriendForm(display,parent,_id,_name,_phone);
display.setCurrent(dff);
}
else
{
ModifyFriendForm mff
= new ModifyFriendForm(display,parent,_id,_name,_phone);
display.setCurrent(mff);
}
}
}