×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    43

    how to show a splash screen, then a list?

    trying to display a splash screen & few seconds after that, to a selection menu (a list) below is what i have in my midlet:

    //***********************************************

    package slider;

    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import java.util.*;

    public class Slider extends MIDlet implements CommandListener {
    private Display display;
    private List lsMenuList;
    private Command cmExit;
    private SliderCanvas canvas;
    private SplashCanvas splash;
    private static Slider instance;
    private Timer tm1;
    private SliderTimerTask tt1;


    /** Constructor */
    public Slider() {
    instance = this;
    display = Display.getDisplay(this);
    cmExit = new Command("Exit", Command.EXIT, 1);
    canvas = new SliderCanvas(this);
    splash = new SplashCanvas(this);

    try
    {
    Image images[] = {
    Image.createImage("/bomb.png"),
    Image.createImage("/monkey.png")
    };

    String options[] = {
    "New Game",
    "High Score"
    };

    lsMenuList = new List("Document Option:",
    List.IMPLICIT, options, images);

    lsMenuList.addCommand(cmExit);
    lsMenuList.setCommandListener(this);
    }
    catch(java.io.IOException e)
    {
    System.err.println("Unable to locate or read .png file");
    }


    }

    /** Main method */
    public void startApp() {
    display.setCurrent(lsMenuList);


    }

    /** Handle pausing the MIDlet */
    public void pauseApp() {
    }

    /** Handle destroying the MIDlet */
    public void destroyApp(boolean unconditional) {
    }

    /** Quit the MIDlet */

    public static void quitApp() {
    instance.destroyApp(true);
    instance.notifyDestroyed();
    instance = null;
    }

    public void commandAction(Command c, Displayable s)
    {
    if (c == List.SELECT_COMMAND)
    {
    switch (lsMenuList.getSelectedIndex())
    {
    case 0:
    System.out.println("New Game");

    display.setCurrent(canvas);
    //display.setCurrent(splash);

    tm1 = new Timer();
    tt1 = new SliderTimerTask(canvas, tm1, 240);
    tm1.schedule(tt1,1000,1000);

    break;

    case 1:
    System.out.println("High Score");
    break;

    default:
    System.out.println();
    }
    }
    else if(c == cmExit)
    {
    destroyApp(false);
    notifyDestroyed();
    }
    }

    }

    //*************************************************

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    7

    Try this

    Try the splash screen code from Sun

    http://wireless.java.sun.com/midp/ttips/

  3. #3
    Regular Contributor
    Join Date
    Apr 2003
    Location
    Bangalore
    Posts
    117
    Example give here uses Canvas..Do some changes to fit to your need...Or else you can alco go for Alert ..Stuff like that...

    Regards
    Chandu

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×