package PhoneBook;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
import javax.microedition.rms.InvalidRecordIDException;
import javax.microedition.rms.RecordEnumeration;
import javax.microedition.rms.RecordStore;
import javax.microedition.rms.RecordStoreException;
import javax.microedition.rms.RecordStoreFullException;
import javax.microedition.rms.RecordStoreNotFoundException;
import javax.microedition.rms.RecordStoreNotOpenException;
public class RMSope{
public String storeName;
RecordStore rs=null;
public String name=null;
public RMSope(String storeName){
this.storeName=storeName;
}
public void OpenRMS(){
try {
rs=RecordStore.openRecordStore(storeName,true);
} catch (RecordStoreFullException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RecordStoreNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RecordStoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void addGroup(String gname)
{
byte[] gb=(gname+">").getBytes();
try {
rs.addRecord(gb, 0, gb.length);
//System.out.println(rs.getNumRecords());
} catch (RecordStoreNotOpenException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RecordStoreFullException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RecordStoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void AddOnetoGroup(String gname,String name)
{
String infor=null;
String newstr=null;
byte[] b=null;
int target=0;
try {
int lastid=rs.getNextRecordID();
for(int i=1;i<lastid;i++)
{
try{
infor=new String(rs.getRecord(i));
}
catch (InvalidRecordIDException e) {
}
if(infor.indexOf(">")!=-1)
{
if(infor.substring(0,infor.indexOf(">")).equals(gname))
{
newstr=infor+name+":";
target=i;
break;
}
}
if(infor.indexOf(">")==-1)
{
if(infor.endsWith(gname))
{
newstr=infor+">"+name+":";
target=i;
break;
}
}
}
b=newstr.getBytes();
try{
rs.setRecord(target, b, 0, b.length);
}
catch (InvalidRecordIDException e) {
}
} catch (RecordStoreNotOpenException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RecordStoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void UpdateGroup(String gname,Vector vc)
{
String infor=gname+">";
try {
int lastid=rs.getNextRecordID();
for(int i=0;i<vc.size();i++)
{
infor=infor+vc.elementAt(i)+":";
}
byte[] b=infor.getBytes();
for(int i=1;i<lastid;i++)
{
try{
if((new String(rs.getRecord(i)).indexOf(">"))!=-1)
{
if((new String(rs.getRecord(i)).substring(0,(new String(rs.getRecord(i)).indexOf(">")))).equals(gname))
{
rs.setRecord(i,b, 0,b.length);
}
}
if((new String(rs.getRecord(i)).indexOf(">"))==-1)
{
if((new String(rs.getRecord(i)).equals(gname)))
{
rs.setRecord(i,b, 0,b.length);
}
}
}
catch (InvalidRecordIDException e) {
}
}
} catch (RecordStoreNotOpenException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RecordStoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public Vector searchGnameByname(String name)
{
Vector vc=new Vector();
String oldstr=null;
try {
int lastid=rs.getNextRecordID();
for(int i=1;i<lastid;i++)
{
try{
oldstr=new String(rs.getRecord(i));
}
catch (InvalidRecordIDException e) {
}
if(oldstr.indexOf(name)!=-1)
{
vc.addElement(oldstr.substring(0,oldstr.indexOf(">")));
}
}
} catch (RecordStoreNotOpenException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RecordStoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return vc;
}
public void delGroupBygname(String gname)
{
int lastid=0;
String oldstr=null;
try {
lastid=rs.getNextRecordID();
for(int i=1;i<lastid;i++)
{
try{
oldstr=new String(rs.getRecord(i));
}
catch (InvalidRecordIDException e) {
}
if(oldstr.indexOf(">")!=-1)
{
if(oldstr.substring(0,oldstr.indexOf(">")).equals(gname))
{
try{
rs.deleteRecord(i);
}
catch (InvalidRecordIDException e) {
}
}
}
}
} catch (RecordStoreNotOpenException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RecordStoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void alldelOnefromGroup(String name)
{
String oldstr=null;
String flagstr=null;
int length=0;
int start=0;
try {
int lastid=rs.getNextRecordID();
byte[] gb=null;
for(int i=1;i<lastid;i++)
{
try{
oldstr=new String(rs.getRecord(i));
length=oldstr.length();
start=oldstr.indexOf(">")+1;
if(oldstr.indexOf(">")!=-1)
{
String newstr=oldstr.substring(0,oldstr.indexOf(">"))+">";
for(int j=0;j<length;j++)
{
if(":".equals(String.valueOf(oldstr.charAt(j))))
{
flagstr=oldstr.substring(start,j);
if(flagstr.equals(name))
{
start=j+1;
newstr=newstr+oldstr.substring(start);
gb=newstr.getBytes();
rs.setRecord(i, gb, 0, gb.length);
}
else
{
newstr=newstr+flagstr+":";
start=j+1;
}
}
}
}
}
catch (InvalidRecordIDException e) {
}
}
} catch (RecordStoreNotOpenException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RecordStoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void DelfromNogroup(Vector vc){
int lastid=0;
String newstr="无群组>";
String oldstr=null;
String flagstr=null;
int length=0;
int start=0;
byte[] gb=null;
boolean a=true;
try {
lastid=rs.getNextRecordID();
for(int i=1;i<lastid;i++)
{
try{
oldstr=new String(rs.getRecord(i));
length=oldstr.length();
start=oldstr.indexOf(">")+1;
if(oldstr.indexOf(">")!=-1)
{
if(oldstr.substring(0,oldstr.indexOf(">")).equals("无群组"))
{
for(int j=0;j<length;j++)
{
if(":".equals(String.valueOf(oldstr.charAt(j))))
{
flagstr=oldstr.substring(start,j);
for(int k=0;k<vc.size();k++)
{
if(vc.elementAt(k).equals(flagstr))
{
start=j+1;
a=false;
newstr=newstr+oldstr.substring(start);
break;
}
}
if(a)
{
newstr=newstr+flagstr+":";
start=j+1;
}
}
}
gb=newstr.getBytes();
rs.setRecord(i, gb, 0, gb.length);
}
}
}
catch (InvalidRecordIDException e) {
}
}
} catch (RecordStoreNotOpenException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RecordStoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void delOnefromGroup(String name,String gname){
try {
int lastid=rs.getNextRecordID();
byte[] gb=null;
String oldstr=null;
for(int i=1;i<lastid;i++)
{
try{
oldstr=new String(rs.getRecord(i));
}
catch (InvalidRecordIDException e) {
}
int length=oldstr.length();
int start=oldstr.indexOf(">")+1;
String flagstr=null;
String newstr=gname+">";
if(oldstr.substring(
没有合适的资源?快使用搜索试试~ 我知道了~
eclipse+wtk写的j2me电话本程序
共75个文件
class:36个
java:18个
jpg:10个
4星 · 超过85%的资源 需积分: 10 76 下载量 23 浏览量
2009-05-18
20:52:21
上传
评论 2
收藏 281KB RAR 举报
温馨提示
实现了添加删除修改,分组,可以选择图片作为头像,将联系人分组
资源推荐
资源详情
资源评论
收起资源包目录
PhoneBook.rar (75个子文件)
PhoneBook
.project 541B
bin
header5.jpg 3KB
welcome.gif 10KB
header3.jpg 3KB
PhoneBook
AddMembertoGroup.class 3KB
AddGroup.class 2KB
ShowPhoneinGroup.class 4KB
CShowPhoneDetail.class 4KB
RMSope.class 10KB
PhonePeople.class 3KB
Welcome.class 5KB
Group.class 2KB
SelectPhoto.class 3KB
PhoneBookMIDlet.class 6KB
AddNewPhone.class 5KB
FindPeople.class 4KB
SelectMember.class 3KB
CSelectPhoto.class 3KB
ShowPhoneDetail.class 4KB
RelationPepole.class 2KB
UpdatePhone.class 4KB
Search.class 2KB
header1.jpg 3KB
header4.jpg 4KB
header2.jpg 5KB
.settings
org.eclipse.jdt.core.prefs 208B
deployed
PhoneBook.jar 68KB
PhoneBook.jad 275B
.eclipseme.tmp
emulation
PhoneBook.jar 67KB
PhoneBook.jad 275B
verified
libs
classes
PhoneBook
AddMembertoGroup.class 4KB
AddGroup.class 2KB
ShowPhoneinGroup.class 4KB
CShowPhoneDetail.class 4KB
RMSope.class 14KB
PhonePeople.class 3KB
Welcome.class 6KB
Group.class 3KB
SelectPhoto.class 3KB
PhoneBookMIDlet.class 6KB
AddNewPhone.class 5KB
FindPeople.class 5KB
SelectMember.class 3KB
CSelectPhoto.class 3KB
ShowPhoneDetail.class 4KB
RelationPepole.class 2KB
UpdatePhone.class 4KB
Search.class 2KB
src
PhoneBook
PhonePeople.java 2KB
ShowPhoneinGroup.java 3KB
Welcome.java 5KB
RMSope.java 15KB
ShowPhoneDetail.java 3KB
Search.java 2KB
AddNewPhone.java 4KB
PhoneBookMIDlet.java 5KB
AddGroup.java 1KB
UpdatePhone.java 3KB
SelectPhoto.java 2KB
RelationPepole.java 1KB
SelectMember.java 2KB
CShowPhoneDetail.java 2KB
CSelectPhoto.java 2KB
FindPeople.java 3KB
Group.java 2KB
AddMembertoGroup.java 2KB
.eclipseme 242B
PhoneBook.jad 251B
res
header5.jpg 3KB
welcome.gif 10KB
header3.jpg 3KB
header1.jpg 3KB
header4.jpg 4KB
header2.jpg 5KB
.classpath 242B
共 75 条
- 1
资源评论
- xingxing69602011-11-05为什么运行不出来结果啊?
taozi40602748
- 粉丝: 3
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 流程图转PAD-N-S图和伪码(软件工程).doc
- C#winform excel导入导出
- 毕业论文上传111111111111
- raisin.zip
- 322个地级市-市场分割指数、市场一体化指数+居民消费价格指数(2004-2022年).txt
- 《基于Java实现自定义控件-天气温度折线图 》+源代码+设计资料
- 希尔伯特矩阵来综合演示数值矩阵与符号矩阵的基本操作
- 《基于51单片机和DS18B20的温度检测和报警系统,可设置报警温度上下限,输出温度采用数码管显示 》+源代码+设计资料
- ESP8266WIFI系统工作原理图.schdoc
- C语言《基于STM32的测量温度与压力的数据处理设计 》+源代码+设计资料
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功