Return to Snippet

Revision: 1781
at November 10, 2006 00:04 by whitetiger


Updated Code
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

public class HelloJ2ME_a1 extends MIDlet
{
	private Display mDisplay;
	private Form mForm;
	
	protected void startApp() throws MIDletStateChangeException
	{
		if(mForm == null)
		{
			// Creo il Form dove inserire il messaggio (questo puo' essere pensato come ad un JFrame)
			mForm = new Form("Hello J2ME !!!");
			
			// Ottengo un Display per la MIDlet
			mDisplay = Display.getDisplay(this);
		}
		
		// Imposto il Form corrente nel Display
		mDisplay.setCurrent(mForm);
	}

	protected void pauseApp()
	{

	}

	protected void destroyApp(boolean arg0) throws MIDletStateChangeException
	{
		// Notifico alla JVM della morte della MIDlet (viene chiamato il Garbage Collector)
		this.notifyDestroyed();
	}
}

Revision: 1780
at November 9, 2006 23:55 by whitetiger


Initial Code
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

public class HelloJ2ME_a1 extends MIDlet
{
	private Display mDisplay;
	private Form mForm;
	
	protected void startApp() throws MIDletStateChangeException
	{
		if(mForm == null)
		{
			// Creo il Form dove inserire il messaggio (questo puo' essere pensato come ad un JFrame)
			mForm = new Form("Hello J2ME !!!");
			
			// Ottengo un Display per la MIDlet
			mDisplay = Display.getDisplay(this);
		}
		
		// Imposto il Form corrente nel Display
		mDisplay.setCurrent(mForm);
	}

	protected void pauseApp()
	{

	}

	protected void destroyApp(boolean arg0) throws MIDletStateChangeException
	{
		// Notifico alla JVM della morte della MIDlet (viene chiamato il Garbage Collector)
		this.notifyDestroyed();
	}
}

Initial URL


Initial Description


Initial Title
J2ME - HelloWorld

Initial Tags
phone, image, java, images, mobile

Initial Language
Java