Probleme pour afficher une appl J2ME
Résolu
kakashi05
Messages postés
195
Statut
Membre
-
kakashi05 Messages postés 195 Statut Membre -
kakashi05 Messages postés 195 Statut Membre -
Bonjour,
je suis entrain d'apprendre du J2ME donc j'essai de faire une peite application qui va se presenter sous forme de formulaire ou j'aurai des champs à remplir et des cases à coché donc mon probleme est la suivant j'arrive pas afficher en meme temps le formulaire et les cases à cocher je vous montre mon code si quelqu'un a une idee
je suis entrain d'apprendre du J2ME donc j'essai de faire une peite application qui va se presenter sous forme de formulaire ou j'aurai des champs à remplir et des cases à coché donc mon probleme est la suivant j'arrive pas afficher en meme temps le formulaire et les cases à cocher je vous montre mon code si quelqu'un a une idee
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.obex.PasswordAuthentication;
/**
* @author
*/
public class Telephone1 extends MIDlet implements CommandListener{
private Display display;
private TextField login, password;
private Form form;
private Command commandexit,commandok;
private List list;
String fruit[]={"Mango","Orange","Tomato"};
public Telephone1(){
display=Display.getDisplay(this);
//Affichage du message Bienvenu dans la barre des titres
form =new Form("Bienvenu dans ce programme");
//Creation du champ login avec une taille maxi de 30 caracteres
login=new TextField("Login","", 30, TextField.ANY);
//Creation du champ password avec une taille maxi de 30 caracteres et crypté
password= new TextField("Password", "", 30,TextField.PASSWORD);
//liste des produits
list =new List("Liste de fruit", Choice.EXCLUSIVE,fruit,null);
//creation d'un bouton Ok pour valider le programme
commandok= new Command("Ok", Command.OK,1);
//creation d'un bouton Exit pour sortir du programme
commandexit= new Command("Exit", Command.EXIT,2);
//ici on fait appel au diferent fonction
form.append(login);
form.append(password);
form.addCommand(commandok);
form.addCommand(commandexit);
//paramettre tres important s'il n'est pas present les bontons ne
//marcheront pas
form.setCommandListener(this);
}
public void startApp() throws MIDletStateChangeException {
display.setCurrent(form);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable s) {
//si on clique sur le bouton Exit
if(c == commandexit){
//appel manuel à la fermeture
destroyApp(false);
//on demande au manager de refermer l'application
notifyDestroyed();
}
}
}
A voir également:
- Probleme pour afficher une appl J2ME
- Afficher appdata - Guide
- Afficher taille dossier windows - Guide
- Windows 11 afficher d'autres options - Guide
- Afficher calendrier outlook dans google agenda - Guide
- Afficher mot de passe wifi android - Guide
1 réponse
Probleme resolu
voila le nouveau code
voila le nouveau code
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.obex.PasswordAuthentication;
/**
* @author Sangare
*/
public class Telephone1 extends MIDlet implements CommandListener{
private Display display;
private TextField login, password;
private Form form;
private Command commandexit,commandok;
private List list;
private ChoiceGroup cg;
public Telephone1(){
display=Display.getDisplay(this);
//Affichage du message Bienvenu dans la barre des titres
form =new Form("Bienvenu dans ce programme");
//Creation du champ login avec une taille maxi de 30 caracteres
login=new TextField("Login","", 30, TextField.ANY);
//Creation du champ password avec une taille maxi de 30 caracteres et crypté
password= new TextField("Password", "", 30,TextField.PASSWORD);
//Creation de la zone avec la possibilité de selectionner un seul fruit
cg= new ChoiceGroup("Choisiez votre fruit",Choice.EXCLUSIVE,new String [] {"Mango","Orange","Tomato"},null );
//creation d'un bouton Ok pour valider le programme
commandok= new Command("Ok", Command.OK,1);
//creation d'un bouton Exit pour sortir du programme
commandexit= new Command("Exit", Command.EXIT,2);
//ici on fait appel au diferent fonction
form.append(login);
form.append(password);
form.addCommand(commandok);
form.addCommand(commandexit);
//ici on va faire appel à la liste de fruit
form.append(cg);
//paramettre tres important s'il n'est pas present les bontons ne
//marcheront pas
form.setCommandListener(this);
}
public void startApp() throws MIDletStateChangeException {
display.setCurrent(form);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable s) {
//si on clique sur le bouton Exit
if(c == commandexit){
//appel manuel à la fermeture
destroyApp(false);
//on demande au manager de refermer l'application
notifyDestroyed();
}
}
}