لقد وضعته على الموبايل nokia n70 لكنه يصدر رسالة n est pas fiable وهي بالفرنسية تعني ان البرنامج غير متماسك واليكم كوده وهو اول برنامج اصنعه ب
j2me
first class
public class emploi
{
private int j;
private String jour;
private String heure;
private String matiere="khawi";
public void emploi(String j,String h,String m){jour=j; heure=h; matiere=m;}
public void emploi(){}
public int get_num(){return j;}
public String get_jour(){return jour;}
public String get_heure(){return heure;}
public String get_matiere(){return matiere;}
public void set_num(int n){j=n;}
public void set_jour(String j){jour=j;}
public void set_heure(String h){heure=h;}
public void set_matiere(String m){matiere=m;}
public String toString(){return jour+ "/"+heure+"*"+matiere; }
}//
end of class
second class main
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.rms.*;
import java.lang.*;
import java.util.*;
public class samir extends MIDlet
implements CommandListener
{
Command cbb;
String sm,sh,sd;
Font font1,font2,font3;
int gh,ind;
int y=0,x=0;
String holo;
Alert aa;
int id;
RecordStore rmn;
int in1,in2,cvc=0,cvcc=0,cvvc=0;
int ccc=0;
int ccl=0;
int[] nuR;
int nr=0;
Command delete;
int nu=0;
Ticker tt;
Command tol2;
String st;
int ch;
List g;
emploi em;
List end;
Form frm;
RecordStore d;
RecordStore rj;
RecordStore rh;
RecordStore rm;
TextBox b;
List l1;
Display dis;
String[] jours;
Command cex;
String[] heures;
List l2;
Command cb;
TextBox tb;
Command ikhtiar;
int jour;
int heure;
Command afficher;
List tous;
String[] infoemploi;
int i=0;
int j;
int k;
int posl1;
int posl2;
Command rojo;
String ss;
String sss;
String sq="khawi";
String oo="123456";
Command cl1;
TextBox ttt;
public void samir(){
}
public void startApp(){
g= new List("choisir ::choice::ikhtar haja",List.IMPLICIT);
g.append("add clause:: matiere ::dkhl lmawwad",null);
g.append("afficher:: showing ::beyn chi madda",null);
g.append("clear all:: supprimer tous::khwi l3alam",null);
g.append("info::ma3lomat",null);
cl1=new Command("alayamo::jours::days",Command.BACK,0);
jours=new String[7];
jours[0]="alithnayno::monday::lundi"; jours[1]="atholathao::tuesday::mardi"; jours[2]="alarbi3ao::wednesday"; jours[3]="alkhamisso::thursday::jeudi"; jours[4]="aljomo3ato::friday::vendredi"; jours[5]="assabto::saturday::samedi"; jours[6]="alahado::sunday::dimanche";
l1=new List("alayamo::jours::days",List.IMPLICIT,jours,null);
rojo=new Command("rojo3::back::retour",Command.BACK,0);
l1.addCommand(rojo);
cex=new Command("khoroj::exit::sortir",Command.EXIT,3);
dis=Display.getDisplay(this);
font1=Font.getFont(Font.FACE_MONOSPACE,Font.STYLE_ITALIC,Font.SIZE_LARGE);
font2=Font.getFont(Font.FACE_PROPORTIONAL,Font.STYLE_ITALIC,Font.SIZE_LARGE);
font3=Font.getFont(Font.FACE_SYSTEM,Font.STYLE_ITALIC,Font.SIZE_LARGE);
g.setFont(0,font1);
g.setFont(1,font2);
g.setFont(2,font3);
g.setFitPolicy(1);
g.addCommand(cex);
g.setCommandListener(this);
dis.setCurrent(g);
}
public void pauseApp(){
}
public void destroyApp(boolean a){
}
public void commandAction(Command c,Displayable s){
if(s==g){
if(c==g.SELECT_COMMAND){
ch=g.getSelectedIndex();
if(ch==0){
l1.setCommandListener(this);
dis.setCurrent(l1);
}
else if(ch==1){
l1.setCommandListener(this);
dis.setCurrent(l1);
}
else if(ch==2){
try{rm=RecordStore.openRecordStore("matier",true);
if(rm.getNumRecords()!=0){
rm.deleteRecordStore("matier");
rm.closeRecordStore();
aa=new Alert("assarem","good::bravo::rak khwitih bravo 3lik",null,AlertType.CONFIRMATION);
dis.setCurrent(aa,g);
}
else{
rm.closeRecordStore();
aa=new Alert("assarem","usetime is empty::emploi vide::rak mazal ma3mrti sti3mal zzaman",null,AlertType.ALARM);
dis.setCurrent(aa,g);}
}
catch(RecordStoreException e){throw new RuntimeException("ffffffffff"+e);}
}
else if(ch==3){frm=new Form("alma3lomato::info");
frm.setTicker(new Ticker("min i3dad::created by::creer par:: assarem assarao abdessamad jnan lahrichi"));
cbb=new Command("rojo3::back::retour",Command.BACK,0);
frm.addCommand(cbb);
frm.setCommandListener(this);
dis.setCurrent(frm);}
}
}
else if(s==l1){
if(c==l1.SELECT_COMMAND){
posl1=l1.getSelectedIndex();
heures=new String[8];
heures[0]="8-9"; heures[1]="9-10"; heures[2]="10-11"; heures[3]="11-12"; heures[4]="2-3"; heures[5]="3-4"; heures[6]="4-5"; heures[7]="5-6";
l2=new List("assa3at",List.IMPLICIT,heures,null);
cb=new Command("rojo3::back::retour",Command.BACK,0);
l2.addCommand(cb);
l2.setCommandListener(this);
dis.setCurrent(l2);
l2.addCommand(cl1); }
else if(c==rojo){g.setCommandListener(this);dis.setCurrent(g);}
}
else if(s==l2){if(c==cl1){l1.setCommandListener(this);dis.setCurrent(l1);} if(c==l2.SELECT_COMMAND){
posl2=l2.getSelectedIndex();
if(ch==0){
tb=new TextBox("oktobi lmadda::write the clause::entrer la matiere"," ",20,0);
ikhtiar=new Command("adkhil::add",Command.SCREEN,0);
cb=new Command("rojo3::back::retour",Command.BACK,0);
tb.addCommand(cb);
tb.addCommand(ikhtiar);
tb.setCommandListener(this);
dis.setCurrent(tb);
}
else if(ch==1) { try {
rm=RecordStore.openRecordStore("matier",true);
tol2=new Command("assa3ato::hours::heures",Command.BACK,0);
String sm,sh,ss,sd;
int gh,ind,iii;
RecordEnumeration en=rm.enumerateRecords(null,null,false);
while(en.hasNextElement()) {iii=en.nextRecordId();
ss=new String(rm.getRecord(iii));
gh=ss.indexOf("/");
ind=ss.indexOf("*");
sd=ss.substring(0,gh);
sh=ss.substring(gh+1,ind);
if(l1.getString(posl1).compareTo(sd)==0 &&l2.getString(posl2).compareTo(sh)==0 ){
sq=ss; }
}
}
catch(RecordStoreException e){throw new RuntimeException("zzzzz"+e);}
delete=new Command("mssh::delete::supp",Command.SCREEN,0);
ttt=new TextBox(sq,"alma3lomat lfo9::info in top::info dessus",60,0);sq="empty::khawi";
ttt.addCommand(tol2);
ttt.addCommand(delete);
ttt.setCommandListener(this);
dis.setCurrent(ttt);
}
}
}
else if(c==cb){l2.setCommandListener(this);dis.setCurrent(l2);}
else if(c==cl1){l2.setCommandListener(this);dis.setCurrent(l2);}
String sd,smm,sjj,shh;
if(c==delete){
try{ rm=RecordStore.openRecordStore("matier",true);
RecordEnumeration ennkk=rm.enumerateRecords(null,null,true);
while(ennkk.hasNextElement())
{cvc=ennkk.nextRecordId();
sd=new String(rm.getRecord(cvc));
if(ttt.getTitle().compareTo(sd)==0){
cvcc=cvc;
}
}
if(cvcc!=0){
rm.deleteRecord(cvcc);
aa= new Alert("lmadda","tmsshat bikol taekid::remove already::supp avec succes",null,AlertType.CONFIRMATION);
dis.setCurrent(aa,ttt);
ttt.setTitle("khawi::empty::vide");}
else{ttt.setString("warah khawi malk::is empty::vide");}cvcc=0;
rm.closeRecordStore();
}
catch(RecordStoreException e){throw new RuntimeException("warak ralt malk"+e);}
}
else if(c==ikhtiar){
try{rm=RecordStore.openRecordStore("matier",true);
if(rm.getNumRecords()==0){
em=new emploi();
em.set_jour(l1.getString(posl1));
em.set_heure(l2.getString(posl2));
em.set_matiere(tb.getString());
byte[] bytm=em.toString().getBytes();
rm.addRecord(bytm,0,bytm.length);
rm.closeRecordStore();
aa=new Alert("ok::hakadak","mzian dkhlat lmadda::already::avec succes",null,AlertType.CONFIRMATION);
dis.setCurrent(aa,tb);
}
else{
RecordEnumeration enb=rm.enumerateRecords(null,null,false);
while(enb.hasNextElement()){
y=enb.nextRecordId();
holo=new String(rm.getRecord(y));
gh=holo.indexOf("/");
ind=holo.indexOf("*");
sd=holo.substring(0,gh);
sh=holo.substring(gh+1,ind);
if(l1.getString(posl1).compareTo(sd)==0 &&l2.getString(posl2).compareTo(sh)==0 )
{x=y;rm.deleteRecord(x);
}
}
rm=RecordStore.openRecordStore("matier",true);
em=new emploi();
em.set_jour(l1.getString(posl1));
em.set_heure(l2.getString(posl2));
em.set_matiere(tb.getString());
byte[] bytm=em.toString().getBytes();
rm.addRecord(bytm,0,bytm.length);
rm.closeRecordStore();
aa=new Alert("ok::hakadak","mzian bravo dkhlat lmadda tbdlat::already::avec succes",null,AlertType.CONFIRMATION);
dis.setCurrent(aa,tb);
}
}catch(RecordStoreException e){throw new RuntimeException("record makhdamch"+e);}
}
else if(c==cex){destroyApp(false);notifyDestroyed();}
else if(c==cbb){g.setCommandListener(this);dis.setCurrent(g);}
else if(c==tol2){try{
rm.closeRecordStore();}catch(RecordStoreException e){throw new RuntimeException("iwa hdi rassk"+e);};l2.setCommandListener(this);dis.setCurrent(l2);}
}//end commandAction
}ما المشكلة ادن
