FileDocCategorySizeDatePackage
SplashScreen.javaAPI DocphoneME MR2 API (J2ME)3934Wed May 02 18:00:06 BST 2007com.sun.midp.appmanager

SplashScreen

public class SplashScreen extends Canvas
Implements the splash screen

Fields Summary
private Image
splashScreen
Splash screen image
private Displayable
nextScreen
The displayable to be displayed after SplashScreen is dismissed.
private Display
display
The display associated with Manager midlet.
TimerTask
timerTask
A TimerTask which will be set to switch to the App Manager Screen after its timeout period has elapsed.
Timer
timeoutTimer
A Timer which serves this Splash Screen object to schedule its timeout task
Constructors Summary
SplashScreen(Display display, Displayable nextScreen)
Creates a Splash screen.

param
display - the display associated wit the Manager midlet
param
nextScreen - the screen to be displayed after timeout

        this.nextScreen = nextScreen;
        this.display = display;

        setFullScreenMode(true);
    
Methods Summary
public voidhideNotify()
Override hideNotify to cancel timer task.

        if (timerTask != null) {
            timerTask.cancel();
        }
        timerTask = null;

        timeoutTimer = null;
    
public voidpaint(Graphics g)
Paint splash screen.

param
g Graphics instance to paint on


        // White background
        g.setColor(255, 255, 255);
        g.fillRect(0, 0, getWidth(), getHeight());

        if (splashScreen != null) {
            g.drawImage(splashScreen, 0, 0, Graphics.LEFT | Graphics.TOP);
        }
    
public voidshowNotify()
Override showNotify to set a timer task so that Splash screen automatically switches to the App Manager Screen.

        if (timerTask != null) {
            timerTask.cancel();
        }

        if (timeoutTimer  == null) {
            timeoutTimer = new Timer();
        }
        splashScreen = 
            GraphicalInstaller.getImageFromInternalStorage("splash_screen_" 
            + getWidth() + "x" + getHeight());

        timerTask = new TimeoutTask();
        timeoutTimer.schedule(timerTask, 2000);