花了两天时间搞定了通讯录,基本功能能实现
现在拿出来给大家一起交流,希望大家能找出BUG
截图如下
以下是代码:请保留作者版权,谢谢
//=====================MessageMIDlet主类=============================== package messagemidlet; //主类 import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class MessageMIDlet extends MIDlet { public static MessageMIDlet messagemidlet; private MenuMIDLet menumidlet = new MenuMIDLet(); /** Constructor */ public MessageMIDlet() { messagemidlet = this; } /** Main method */ public void startApp() { Display.getDisplay(this).setCurrent(menumidlet); } /** Handle pausing the MIDlet */ public void pauseApp() { } /** Handle destroying the MIDlet */ public void destroyApp(boolean unconditional) { } /** Quit the MIDlet */ public static void quitApp() { messagemidlet.destroyApp(true); messagemidlet.notifyDestroyed(); messagemidlet = null; } } //=========================end================================ //=========================SetGet操作用到的属性================================ package messagemidlet; ///JAVA为什么不像c#一样有GET SET 来设置属性,所以麻烦点,我还是喜欢C# public class SetGet { public static int Id = 0; public static int DelId = 0; public static int ModId = 0; public static String Str = null; public static boolean IsOK =true ; /** Constructor */ public SetGet() { } public static void SetId(int id){ Id = id; } public static int GetId(){ return Id; } public static void SetDelId(int id) { DelId = id; } public static int GetDelId() { return DelId; } public static void SetModId(int id) { ModId = id; } public static int GetModId() { return ModId; } public static void SetStr(String str){ Str = str; } public static String GetStr(){ return Str; } public static void SetIsTrue(boolean istrue){ IsOK = istrue; } public static boolean GetIsTrue(){ return IsOK; } } //=========================end================================ //=========================PubClass公共类(集成一些常用属性和方法,方便调用)================================ package messagemidlet; import javax.microedition.lcdui.*; import javax.microedition.rms.*; import java.io.*; public class PubClass { public static PubClass pubclass; public Display display; //舞台对象 public Command exitCommand; //离开按钮对象 public Command selectCommand; //选择按钮对象 public Command menuCommand; //主目录 public Command okCommand ; public Command operCommand; public String[] menulist = {'通讯录','关于作者'}; //主菜单选项 public String[] mainlist ={'浏览联系人','查找联系人','添加联系人','其他'}; public String[] operatelist={'编辑联系人','删除联系人','全部删除'}; //操作 //只需修改personpro属性,其他自动生成,构造 public String[] personpro ={'姓名','手机','Email','地址','其他'}; //用户属性 public int Length = personpro.length; //用户属性个数 public String dataname = 'messages'; //数据库名 public boolean existingOrNot = existing(dataname); RecordStore rs = null; public TextField[] person = new TextField[Length]; public StringItem[] persondetail = new StringItem[Length]; /** 构造函数 */ public PubClass() { for(int i=0;i
本文地址:http://com.8s8s.com/it/it13290.htm