Bonjour ,
ça marche bien cette solution pour la midlet mais en ce qui concerne le formulaire je n'arrive pas à l'exécuter.
Pouvez vous m'aider?
Voici le code que j'ai eu:
%%%%%%%%%%%%%%
%%%%%%%%%%%%%%MIDlet
package Test;
import javax.microedition.lcdui.Choice;
import javax.microedition.lcdui.ChoiceGroup;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.*;
public class Tache1 extends MIDlet implements CommandListener {
private Display display;
private Form form;
private ChoiceGroup choiceGroup;
Command cmd;
private final static Command CMD_EXIT = new Command("Exit", Command.EXIT, 1);
public Tache1() {
display = Display.getDisplay(this);
form = new Form("Operation désirée");
choiceGroup = new ChoiceGroup("", Choice.EXCLUSIVE);
choiceGroup.append("mise à jour",null);
choiceGroup.append("recevoir statistiques", null);
choiceGroup.setSelectedFlags(new boolean[] { false, false });
form.append(choiceGroup);
this.cmd = new Command("Suivant", Command.SCREEN, 0);
form.addCommand(cmd);
form.addCommand(CMD_EXIT);
form.setCommandListener(this);
}
public void startApp() {
display.setCurrent(form);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable d) {
if (c == this.cmd){
new update1(this);
}
}
}
%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%FORMULAIRE
package Test;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.ChoiceGroup;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
public class Update1 extends Form implements CommandListener{
Tache1 t;
private Display display;
private Form form;
private ChoiceGroup choiceGroup;
Command cmd;
private final static Command CMD_EXIT = new Command("Exit", Command.EXIT, 1);
public Update1(Tache1 t) {
super ("Mise à jour");
this.t=t;
form=new Form("Mise à jour");
Display.getDisplay(t).setCurrent(this.form);
choiceGroup = new ChoiceGroup("", ChoiceGroup.EXCLUSIVE);
choiceGroup.append("formater", null);
choiceGroup.append("modifier", null);
choiceGroup.append("charger", null);
choiceGroup.append("ajouter", null);
choiceGroup.append("supprimer", null);
choiceGroup.setSelectedFlags(new boolean[] { false, false, false, false,false });
this.form.append(choiceGroup);
this.cmd = new Command("valider", Command.SCREEN, 0);
this.form.addCommand(this.cmd);
this.form.addCommand(CMD_EXIT);
this.form.setCommandListener(this);
}
public void commandAction(Command c, Displayable d) {
if (c == this.cmd) {
String text = " connexion NFC...";
Alert a = new Alert("Please , wait", text, null, AlertType.INFO);
this.display.setCurrent(a);
}
}
}
|