J2ME通讯录代码

类别:Java 点击:0 评论:0 推荐:
TR>
body { background: #fff; color: #000; padding: 15px; } pre { border: none; background: transparent; color: #000; } .coloredcode .cmt { color: #008000; } .coloredcode .cmtg { color: #666; } .coloredcode .st { color: #f00; } .coloredcode .kwdt { color: #666; } .coloredcode .kwd { color: #00f; } .coloredcode .attr { color: #f00; } .coloredcode .attrv { color: #00f; } .coloredcode .ec { color: #00f; } .coloredcode .tag { color: #800000; } .coloredcode .dir { color: #000; background: #FEFF22; } .coloredcode .sel { color: #800000; } .coloredcode .val { color: #00f; } .coloredcode .unit { color: #800000; } .coloredcode .sqlcmt { color: #008080; } .coloredcode .sqlkwd { color: #00f; } .coloredcode .sqlkwd2 { color: #f0f; } .coloredcode .sqlkwd3 { color: #999; } .coloredcode .sqlkwd4 { color: #800000; } .coloredcode .num { color: #00f; } .coloredcode .sqlst { color: #008000;}

花了两天时间搞定了通讯录,基本功能能实现

现在拿出来给大家一起交流,希望大家能找出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