1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
* @author Sangare
*/
public class LesContacts extends MIDlet implements CommandListener {
private Display display;
private Command commandexit,commandok;
private TextField nom,prenom;
private ChoiceGroup cg;
private Form form;
public LesContacts (){
display=Display.getDisplay(this);
//Ici on aura le tire de notre formulaire
form= new Form("Ajouter un Collaborateur");
/*Declaration des 2 champs Nom et Prenom avec une taille maxi de 30 */
nom= new TextField("Nom", "", 30, TextField.ANY);
prenom=new TextField("Prenom", "", 30,TextField.ANY);
/*Declaration des et creation des zones pour faire le choix du sexe*/
cg=new ChoiceGroup("Sexe", Choice.EXCLUSIVE,new String [] {"Masculin", "Femme"},null);
/*Declaration des boutons Ok et Exit*/
commandok=new Command("OK", Command.OK,4);
commandexit=new Command("EXIT",Command.EXIT,7);
/*Appel des fonctions Ok et Exit*/
form.addCommand(commandok);
form.addCommand(commandexit);
//Appel des zones de champs text
form.append(nom);
form.append(prenom);
form.append(cg);
}
public void startApp() {
display.setCurrent(form);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if(c==commandexit){
destroyApp(false);
notifyDestroyed();
}
}
} |
Partager