Splash Screen

Boa tarde pessoal,

Como posso criar uma splash screen para minha aplicação com o logo da empresa ? E qual as dimenções ideais para a imagem para se adaptar na maioria dos dispositivos disponíveis no mercado.
Utilizo MIDP 2.0 e CLDC 1.1

Obrigado a Todos

Olá,
Use Canvas (se vc não sabe como, pesquise, tem material aqui no PJ).
Acho que uma dimensão de imagem ideal seria:
Largura: De 80 a 128
Altura: De 80 a 128

Pintando o resto da tela com a cor de fundo da imagem.

Utilize a classe Timer para fazer o Splash desaparecer na hora que vc deseja.

Até mais!

PS.: Existe uma classe de Splash implementada pelo pessoal do Netbeans (dentro do mobility pack) se preferir.

Obrigado pela resposta Clóvis, mas gostaria de saber tb se existe algum diretório em específico onde eu possa colocar a imagem para ser carregada dentro do meu jar. Desde já agradeço.

Um grande abraço e boas festas !

Existe sim, o diretório “res” onde você irá colocar todos os arquivos necessários a sua aplicação e que não são .java

Abraço!

amigo se vc usar a IDE Netbeans, você irá encontrar várias classes já prontas… uma delas é A classe SplashScreem… mto fácil de usar…

No site da SUN tem um tutorial que ensina a fazer uma splash screens (tela de apresentação) usando um simples alerta

public void showSplashScreen(Display d, Displayable next){
   Image logo = null;
   try {
      // res é a pasta padrão de imagens em um projeto de um MIDlet seguido do nome da imagem
      logo = Image.createImage("/res/logo.jpg");
    }
    catch( IOException e ){}
    
    Alert a = new Alert("Time Tracker", "Texto.", logo, null); 
    a.setTimeout(Alert.FOREVER);
    display.setCurrent(a, next);
}
public class ExMIDlet extends MIDlet implements CommandListener {

   private Display display;
   private Command exitCommand = new Command("Exit", Command.EXIT, 1 );

   //construtor
   public ExMIDlet(){}

   protected void destroyApp(boolean unconditional) throws MIDletStateChangeException {
        exitMIDlet();
   }

   protected void pauseApp(){}

   protected void startApp() throws MIDletStateChangeException {
      if(display == null){
           initMIDlet();
      }
   }

   private void initMIDlet(){
       display = Display.getDisplay( this );
       new SplashScreen(display, new TrivialForm() );
   }

   public void exitMIDlet(){
       notifyDestroyed();
   }

    public void commandAction(Command c, Displayable d ){
        exitMIDlet();
    }

    // uma tela (form) trivial p/ a splsh screen
    class TrivialForm extends Form {
        TrivialForm(){
            super("ExMIDlet");
            addCommand(exitCommand);
            setCommandListener(ExMIDlet.this);
        }
    }
}

um carinha deu uma outra idéia

public class ExMIDlet extends MIDlet implements CommandListener {

   //construtor
   public ExMIDlet(){}

   protected void destroyApp(boolean unconditional) throws MIDletStateChangeException {
        exitMIDlet();
   }

   protected void pauseApp(){}

   protected void startApp(){
      Displayable current = Display.getDisplay(this).getCurrent();
      if (current == null){
         //current = vazio, aplicacao iniciando hora de exibir a splash scrren
         SplashScreen splashScreen = new SplashScreen(this, mainMenu);
         Display.getDisplay(this).setCurrent(splashScreen);
         splashScreen.start();
      }

      void start(){
         if (timer != null)
            timer.cancel();
      }

      timer = new Timer();
      TimerTask dismissTask = new TimerTask(){
         public void run(){
            if (timer != null)
               // Cancela o timer (timer.cancel()) e exibe a prox tela de acordo c/ o Construtor
               dismiss();
         }
      };
      // termina com o splash depois de 4 segs
      timer.schedule(dismissTask, 4000L);

SplashScreen com J2ME Polish -> www.joefission.com/2006/05/j2me_polish_13_.html

Exploring the NetBeans Visual Mobile Designer -> www.netbeans.org/kb/41/exploringmvd.html

This is your Splash Class :

import java.io.IOException;
import java.util.;
import javax.microedition.lcdui.
;

public class SplashScreen extends Canvas {

private Display display;
private Displayable next;
private Image resim = null; // picture which will be shown when midlet start
private Timer timer = new Timer();

public SplashScreen( Display display, Displayable next ){
    this.display = display;
    this.next = next;
    display.setCurrent( this );
}

protected void keyPressed( int keyCode ){
    dismiss();
}

protected void paint( Graphics g ){
    try {
        g.setColor(255,255,255);
        g.drawRect(0,0,getWidth(),getHeight());
        resim = Image.createImage("/logo.png");
        g.drawImage (resim, getWidth () / 2, getHeight () / 2, Graphics.HCENTER | Graphics.VCENTER);
    } catch (IOException ex) {
        System.out.println("Can't find logo!"+ex.toString());
    }
}

protected void pointerPressed( int x, int y ){
    dismiss();
}

// Splash time: 5 second
protected void showNotify(){
    timer.schedule( new CountDown(), 5000 );
}

// Cancel splash screen with press any button instead of waiting 5 seconds
private void dismiss(){
timer.cancel();
display.setCurrent(next);
}

private class CountDown extends TimerTask {
    public void run(){
        dismiss();
    }
}

}// end SplashScreen

private void initMIDlet(){
Display screen = Display.getDisplay( this );
new SplashScreen(screen ,menu);
}