import javax.microedition.midlet.*; import javax.microedition.lcdui.*; import javax.microedition.io.*; import java.io.IOException; public class AudioColor extends MIDlet implements CommandListener { private Command cmd_salir, cmd_modo_g; private Form formulario; private ClassPantalla pantalla; private Image IMG0; private ImageItem logo; public AudioColor() { cmd_modo_g=new Command("Cámara", Command.ITEM,2); cmd_salir=new Command("Cerrar", Command.EXIT,7); try { IMG0=Image.createImage("/AudioColorG.png"); } catch (java.io.IOException e) { System.err.println("No se puede leer imagen"); } logo = new ImageItem("Colorímetro",IMG0,ImageItem.LAYOUT_CENTER,null); formulario = new Form("Audio-Color"); formulario.append(logo); formulario.append("\nprb@2006\n"); formulario.addCommand(cmd_salir); formulario.addCommand(cmd_modo_g); formulario.setCommandListener(this); } //********************************************************* //********************************************************* //******* FUNCIONES BASICA DE UN MIDLET ******************* //********************************************************* // // public void startApp() { // public void pauseApp() {} // public void destroyApp(boolean unconditional) { // public void commandAction(Command c, Displayable d) { // //********************************************************* //********************************************************* //********************************************************* public void startApp() { Display.getDisplay(this).setCurrent(formulario); } public void pauseApp() {} public void destroyApp(boolean unconditional) { formulario = null; pantalla = null; } public void commandAction(Command c, Displayable d) { if (c==cmd_modo_g) Modo_Grafico(); else if (c==cmd_salir) { destroyApp(true);notifyDestroyed();} } //********************************************************* //********************************************************* //******* FUNCIONES DE LA APLICACION ********************** //********************************************************* // // public void Modo_Grafico() { // //********************************************************* //********************************************************* //********************************************************* public void Modo_Grafico() { pantalla=new ClassPantalla(); Display.getDisplay(this).setCurrent(pantalla); } } //Fin MIDlet