// Example Hello World Java MicroEdition
1
2 import javax.microedition.lcdui.Display;
3 import javax.microedition.lcdui.Form;
4 import javax.microedition.midlet.MIDlet;
5 import javax.microedition.midlet.MIDletStateChangeException;
6
7 public class HelloJ2ME_a1 extends MIDlet
8 {
9 private Display mDisplay;
10 private Form mForm;
11
12 protected void startApp() throws MIDletStateChangeException
13 {
14 if(mForm == null)
15 {
16 // Creo il Form dove inserire il messaggio (questo puo' essere pensato come ad un JFrame)
17 mForm = new Form("Hello J2ME !!!");
18
19 // Ottengo un Display per la MIDlet
20 mDisplay = Display.getDisplay(this);
21 }
22
23 // Imposto il Form corrente nel Display
24 mDisplay.setCurrent(mForm);
25 }
26
27 protected void pauseApp()
28 {
29
30 }
31
32 protected void destroyApp(boolean arg0) throws MIDletStateChangeException
33 {
34 // Notifico alla JVM della morte della MIDlet (viene chiamato il Garbage Collector)
35 this.notifyDestroyed();
36 }
37 }