📄 deletefriend.java
字号:
/**
* @(#)DeleteFriend.java
* Copyright (c) 2004-2005 wuhua of workroom Inc. All Rights Reserved.
* @version 1.0, 10/05/2004
* @author 饶荣庆
* @author
*/
package com.j2me.phonebook;
import com.j2me.main.*;
import javax.microedition.lcdui.*;
/**
*此类的功能是删除朋友信息
*/
public class DeleteFriend extends Form implements CommandListener
{
private Display display = null;
private PhoneBookMenu phoneBookMenu = null;
public Alert alert = null;
public StringItem idItem = null;
public Command okCommand = null; //定义确定软键
public Command backCommand = null; //定义离开软键
private int id;
public DeleteFriend(String s, int id, String name, String phone, String eMail) //把参数传进去
{
super(s);
this.id = id; //获得朋友id
this.alert = new Alert("提示", "删除成功", null, AlertType.INFO); //初始化信息
this.alert.setTimeout(1000);
this.okCommand = new Command("确定", Command.OK, 2);
this.backCommand = new Command("返回", Command.BACK, 2);
this.idItem = new StringItem("删除这个记录", name);
this.append(idItem);
this.addCommand(backCommand);
this.addCommand(okCommand);
this.setCommandListener(this);
}
public void showForm(Display display, PhoneBookMenu phoneBookMenu) //用来显示界面
{
this.display = display;
this.phoneBookMenu = phoneBookMenu;
this.display.setCurrent(this);
}
public void commandAction(Command c,Displayable s)
{
if(c == backCommand)
{
this.display.setCurrent(phoneBookMenu);
}
if (c == okCommand)
{
PhoneBook pb = new PhoneBook();
pb.deleteFriend(id); //调用删除方法
pb.closeRS();
this.display.setCurrent(alert, phoneBookMenu);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -