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
|
package midletbouton;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
public class Midlet extends MIDlet implements ItemCommandListener,CommandListener {
private Display display;
private Form mainForm;
private final static Command CMD_PRESS = new Command("Press", Command.ITEM, 1);
private int alpha= 0;
private int beta = 0;
protected void startApp() {
display = Display.getDisplay(this);
mainForm = new Form("test bouton !");
StringItem item = new StringItem("bouton","clic",Item.BUTTON );
item.setDefaultCommand(CMD_PRESS);
mainForm.append("alpha");
TextField textbox1 = new TextField("", "", 15, TextField.NUMERIC);
mainForm.append(textbox1);
mainForm.append("beta");
TextField textbox2 = new TextField("", "", 15, TextField.NUMERIC);
mainForm.append(textbox2);
item.setItemCommandListener(this);
mainForm.append(item);
display.setCurrent(mainForm);
}
public void commandAction(Command c, Item item) {
if (c == CMD_PRESS) {
}
}
public void commandAction(Command c, Displayable d) {
destroyApp(false);
notifyDestroyed();
}
protected void destroyApp(boolean unconditional) {
}
/**
* Signals the MIDlet to stop and enter the Paused state.
*/
protected void pauseApp() {
}
} |
Partager