org.netbeans.microedition.lcdui
Class SplashScreen

java.lang.Object
  extended by javax.microedition.lcdui.Displayable
      extended by javax.microedition.lcdui.Canvas
          extended by org.netbeans.microedition.lcdui.AbstractInfoScreen
              extended by org.netbeans.microedition.lcdui.SplashScreen

public class SplashScreen
extends AbstractInfoScreen

This component represents a splash screen, which is usually being displayed when the application starts. It waits for a specified amount of time (by default 5000 milliseconds) and then calls specified command listener commandAction method with DISMISS_COMMAND as command parameter.

This version is using CommandListener and static Command pattern, but is still compatible with older version. So if there is no command listener specified, it still can use setNextDisplayable() method to specify the dismiss screen and automatically switch to it.


Field Summary
static javax.microedition.lcdui.Command DISMISS_COMMAND
          Command fired when the screen is about to be dismissed
static int FOREVER
          Timeout value which wait forever.
 
Fields inherited from class javax.microedition.lcdui.Canvas
DOWN, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_POUND, KEY_STAR, LEFT, RIGHT, UP
 
Constructor Summary
SplashScreen(javax.microedition.lcdui.Display display)
          Creates a new instance of SplashScreen
 
Method Summary
 int getTimeout()
          Gets current timeout of the splash screen
protected  void hideNotify()
           
 boolean isAllowTimeoutInterrupt()
          Can be the splashscreen interrupted (dismissed) by the user pressing a key?
protected  void keyPressed(int keyCode)
          keyPressed callback
protected  void pointerPressed(int x, int y)
          pointerPressed callback
 void setAllowTimeoutInterrupt(boolean allow)
          When set to true, the splashscreen timeout can be interrupted (and thus dismissed) by pressing a key.
 void setTimeout(int timeout)
          Sets the timeout of the splash screen - i.e.
protected  void showNotify()
          starts the coundown of the timeout
 
Methods inherited from class org.netbeans.microedition.lcdui.AbstractInfoScreen
getColorSchema, getCommandListener, getDisplay, getImage, getNextAlert, getNextDisplayable, getText, getTextFont, paint, setColorSchema, setCommandListener, setImage, setNextDisplayable, setNextDisplayable, setText, setTextFont, sizeChanged, switchToDisplayable, switchToNextDisplayable
 
Methods inherited from class javax.microedition.lcdui.Canvas
getGameAction, getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, isDoubleBuffered, keyReleased, keyRepeated, pointerDragged, pointerReleased, repaint, repaint, serviceRepaints, setFullScreenMode
 
Methods inherited from class javax.microedition.lcdui.Displayable
addCommand, getHeight, getTicker, getTitle, getWidth, isShown, removeCommand, setTicker, setTitle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DISMISS_COMMAND

public static final javax.microedition.lcdui.Command DISMISS_COMMAND
Command fired when the screen is about to be dismissed


FOREVER

public static final int FOREVER
Timeout value which wait forever. Value is "0".

See Also:
Constant Field Values
Constructor Detail

SplashScreen

public SplashScreen(javax.microedition.lcdui.Display display)
             throws java.lang.IllegalArgumentException
Creates a new instance of SplashScreen

Parameters:
display - display - cannot be null
Throws:
java.lang.IllegalArgumentException - when the display parameter is null
Method Detail

setTimeout

public void setTimeout(int timeout)
Sets the timeout of the splash screen - i.e. the time in milliseconds for how long the splash screen is going to be shown on the display.

If the supplied timeout is 0, then the splashscreen waits forever (it needs to be dismissed by pressing a key)

Parameters:
timeout - in milliseconds

getTimeout

public int getTimeout()
Gets current timeout of the splash screen

Returns:
timeout value

setAllowTimeoutInterrupt

public void setAllowTimeoutInterrupt(boolean allow)
When set to true, the splashscreen timeout can be interrupted (and thus dismissed) by pressing a key.

Parameters:
allow - true if the user can interrupt the screen, false if the user need to wait until timeout.

isAllowTimeoutInterrupt

public boolean isAllowTimeoutInterrupt()
Can be the splashscreen interrupted (dismissed) by the user pressing a key?

Returns:
true if user can interrupt it, false otherwise

keyPressed

protected void keyPressed(int keyCode)
keyPressed callback

Overrides:
keyPressed in class javax.microedition.lcdui.Canvas
Parameters:
keyCode -

pointerPressed

protected void pointerPressed(int x,
                              int y)
pointerPressed callback

Overrides:
pointerPressed in class javax.microedition.lcdui.Canvas
Parameters:
x -
y -

showNotify

protected void showNotify()
starts the coundown of the timeout

Overrides:
showNotify in class AbstractInfoScreen

hideNotify

protected void hideNotify()
Overrides:
hideNotify in class javax.microedition.lcdui.Canvas