We Recommend

Java How to Program Java How to Program
Takes a new tools-based approach to Web application development that uses Netbeans 5.5 and Java Studio Creator 2 to create and consume Web Services. Features new AJAX-enabled, Web applications built with JavaServer Faces (JSF), Java Studio Creator 2 and the Java Blueprints AJAX Components. Includes new topics throughout, such as JDBC 4, SwingWorker for multithreaded GUIs, GroupLayout, Java Desktop Integration Components (JDIC), and much more.


Posted By

whitetiger on 11/09/06


Tagged

phone image jpg java rotate images properties mobile system RGB j2me flip half zoom


Versions (?)


J2ME - HelloWorld


Published in: Java 


  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 

You need to login to post a comment.