Bonjour,
je suis débutante en java ainsi qu'en j2me..
mon problème réside dans le fait qu'après exécution de mon code, je n'obtient pas le résultat attendu bien que le code est très claire et c'est à l'aide du tutoriel "Débuter en J2ME avec le profil MIDP" http://defaut.developpez.com/tutoriel/java/j2me/
que j'ai pu le raffiner..
bref, voila mon code et voulez vous m'indiquer où réside l'erreur..
voici une capture d'écran du résultat après exécution..
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 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.lcdui.TextField; import javax.microedition.midlet.*; /** * @author amouna */ public class loginForm extends MIDlet implements CommandListener { private Display display; private TextField userName; private TextField password; private Form form; private Command cancel; private Command login; public void LoginMidlet() { display = Display.getDisplay(this); userName = new TextField("LoginID:", "", 10, TextField.ANY); password = new TextField("Password:", "", 10, TextField.PASSWORD); form = new Form("Sign in"); cancel = new Command("Exit", Command.EXIT, 1); login = new Command("Login", Command.OK, 1); form.append(userName); form.append(password); form.addCommand(cancel); form.addCommand(login); form.setCommandListener(this); } public void startApp() { display.setCurrent(form); } public void pauseApp() { } public void destroyApp(boolean unconditional) { notifyDestroyed(); } public void commandAction(Command c, Displayable d) { String label = c.getLabel(); if(label.equals("Exit")) { destroyApp(true); } else if(label.equals("Login")) { //traitement à faire: ouverture d'une socket et se connecter à un serveur } } }
Partager