import javax.microedition.midlet.*; import javax.microedition.lcdui.*; import javax.microedition.io.*; import java.io.IOException; public class HolaMundo extends MIDlet implements CommandListener { private Command cmd_salir; private Form formulario; private Image IMG0; private ImageItem logo; public HolaMundo() { cmd_salir=new Command("Cerrar", Command.EXIT,1); try { IMG0=Image.createImage("/usm.png"); } catch (java.io.IOException e) { System.err.println("No se puede leer imagen"); } logo = new ImageItem("Saludo",IMG0,ImageItem.LAYOUT_CENTER,null); formulario = new Form("Hola Mundo"); formulario.append(logo); formulario.append("\nprb@2006\n"); formulario.addCommand(cmd_salir); formulario.setCommandListener(this); } //********************************************************* //********************************************************* //******* FUNCIONES BASICA DE UN MIDLET ******************* //********************************************************* public void startApp() { Display.getDisplay(this).setCurrent(formulario); } public void pauseApp() {} public void destroyApp(boolean unconditional) { formulario = null; } public void commandAction(Command c, Displayable d) { if (c==cmd_salir) { destroyApp(true);notifyDestroyed();} } } //Fin MIDlet