Pantalla de presentacion - Favor decirme como ejecutarlo

jomaov
10 de Septiembre del 2008
Codigo pantalla de presentacion


package ncy.picview;
import java.util.*;
import javax.microedition.lcdui.*;

public class PantPresentacion extends Canvas {
private Display display;
private Timer t = new Timer();
public PantPresentacion( Display display,Displayable PicViewCanvas ) { this.display = display;
display.setCurrent( this );
}
private void concluir() {
t.cancel();
}
protected void keyPressed( int keyCode ) {
concluir();
}
protected void pointerPressed( int x,int y ) { concluir();
}
protected void paint( Graphics g ) {
try {
Image imagen = Image.createImage( "/ncy/picview/pintaruna.png" );
int x = ( getWidth() - imagen.getWidth() )/2;
int y = ( getHeight() - imagen.getHeight() )/2;
g.setColor( 0xffffff );
g.fillRect( 0,0,getWidth(),getHeight() );
g.drawImage( imagen,x,y,0 );
} catch( Exception e ) {
return;
}
}
public void showNotify() {
t.schedule( new CuentaAtras(),5000 );
}
private class CuentaAtras extends TimerTask {
public void run() {
concluir();
}
}
}






Código de la aplicación


package ncy.picview;

import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;
import javax.microedition.midlet.*;
import java.io.*;

public class PicView extends MIDlet implements CommandListener {

private Display display;
private PicViewCanvas canvas;
private List picList;

private Command exitCommand =
new Command("Exit", Command.EXIT, 1);
private Command aboutCommand =
new Command("About", Command.ITEM, 5);
private Command backCommand =
new Command("Back", Command.ITEM, 1);

public PicView() {
display = Display.getDisplay(this);

canvas = new PicViewCanvas(this);
canvas.addCommand(backCommand);
canvas.setCommandListener(this);
}
public void startApp() {
picList = canvas.getPicList();
picList.addCommand(exitCommand);
picList.addCommand(aboutCommand);
picList.setCommandListener(this);
display.setCurrent(picList);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
display.setCurrent((Displayable)null);
canvas.destroy();
}
public void commandAction(Command c, Displayable s) {
if (c == picList.SELECT_COMMAND) {
canvas.setPicIndex(picList.getSelectedIndex());
display.setCurrent(canvas);
}
else if (c == backCommand && s == canvas) {
display.setCurrent(picList);
}
else if (c == exitCommand) {
destroyApp(false);
notifyDestroyed(); }
}
}