Posted By


whitetiger on 11/09/06

Statistics


Viewed 734 times
Favorited by 0 user(s)

J2ME - HelloWorld


/ Published in: Java
Save to your folder(s)



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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.