org.netbeans.microedition.lcdui
Class AbstractInfoScreen

java.lang.Object
  extended by javax.microedition.lcdui.Displayable
      extended by javax.microedition.lcdui.Canvas
          extended by org.netbeans.microedition.lcdui.AbstractInfoScreen
Direct Known Subclasses:
SplashScreen, WaitScreen

public abstract class AbstractInfoScreen
extends javax.microedition.lcdui.Canvas

An abstract class serving as a parent for SplashScreen and WaitScreen. This class provides the basic visualization of the screen and can perform automatic switch to a next displayable when the screen is dismissed (either programatically or by user action).

When this screen is displayed, it can display either supplied text or image. The current implementation shows both, text and image, centered in the middle of the display.


Field Summary
 
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
AbstractInfoScreen(javax.microedition.lcdui.Display display)
          Creates a new instance of AbstractInfoScreen
 
Method Summary
protected  javax.microedition.lcdui.Display getDisplay()
          Gets the used display object
 javax.microedition.lcdui.Image getImage()
          Gets the image to be painted on the screen.
protected  javax.microedition.lcdui.Alert getNextAlert()
          gets the next alert
protected  javax.microedition.lcdui.Displayable getNextDisplayable()
          Gets the next displayable
 java.lang.String getText()
          Gets the text to be painted on the screen.
 javax.microedition.lcdui.Font getTextFont()
          Gets the current font used to paint the text.
protected  void paint(javax.microedition.lcdui.Graphics g)
          implementation of abstract method
 void setImage(javax.microedition.lcdui.Image image)
          Sets image to be painted on the screen.
 void setNextDisplayable(javax.microedition.lcdui.Alert nextAlert, javax.microedition.lcdui.Displayable nextDisplayable)
          Requests that the specified Alert is going to be shown in the case of screen dismiss, and nextDisplayable be made current after the Alert is dismissed.
 void setNextDisplayable(javax.microedition.lcdui.Displayable nextDisplayable)
          Sets the displayable to be used to switch when the screen is being dismissed.
 void setText(java.lang.String text)
          Sets the text to be painted on the screen.
 void setTextFont(javax.microedition.lcdui.Font font)
          Sets the font to be used to paint the specified text.
protected  void showNotify()
          sets value of previous displayable.
protected  void sizeChanged(int w, int h)
          repaints the screen whem a size has changed.
protected static void switchToDisplayable(javax.microedition.lcdui.Display display, javax.microedition.lcdui.Alert alert, javax.microedition.lcdui.Displayable displayable)
          Switch to the given displayable and alert
protected  void switchToNextDisplayable()
          switch to the next displayable (or alert)
 
Methods inherited from class javax.microedition.lcdui.Canvas
getGameAction, getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, hideNotify, isDoubleBuffered, keyPressed, keyReleased, keyRepeated, pointerDragged, pointerPressed, pointerReleased, repaint, repaint, serviceRepaints, setFullScreenMode
 
Methods inherited from class javax.microedition.lcdui.Displayable
addCommand, getHeight, getTicker, getTitle, getWidth, isShown, removeCommand, setCommandListener, setTicker, setTitle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractInfoScreen

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

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

setText

public void setText(java.lang.String text)
Sets the text to be painted on the screen.

Parameters:
text - text to be painter, or null if no text should be shown

getText

public java.lang.String getText()
Gets the text to be painted on the screen.

Returns:
text

getImage

public javax.microedition.lcdui.Image getImage()
Gets the image to be painted on the screen.

Returns:
image

setImage

public void setImage(javax.microedition.lcdui.Image image)
Sets image to be painted on the screen. If set to null, no image will be painted

Parameters:
image - image to be painted. Can be null.

setTextFont

public void setTextFont(javax.microedition.lcdui.Font font)
Sets the font to be used to paint the specified text. If set to null, the default font (Font.STATIC_TEXT_FONT) will be used.

Parameters:
font - font to be used to paint the text. May be null.

getTextFont

public javax.microedition.lcdui.Font getTextFont()
Gets the current font used to paint the text.

Returns:
text font

setNextDisplayable

public void setNextDisplayable(javax.microedition.lcdui.Displayable nextDisplayable)
Sets the displayable to be used to switch when the screen is being dismissed.

Parameters:
nextDisplayable - displayable, or null if the component should switch back to the screen from which was displayed prior showing this component.

setNextDisplayable

public void setNextDisplayable(javax.microedition.lcdui.Alert nextAlert,
                               javax.microedition.lcdui.Displayable nextDisplayable)
                        throws java.lang.IllegalArgumentException
Requests that the specified Alert is going to be shown in the case of screen dismiss, and nextDisplayable be made current after the Alert is dismissed.

The nextDisplayable parameter cannot be Alert and in the case nextAlert is not null, it also cannot be null.

Parameters:
nextAlert - alert to be shown, or null if the component should return back to the original screen
nextDisplayable - a displayable to be shown after the alert is being dismissed. This displayable cannot be null if the nextAlert is not null and it also cannot be Alert.
Throws:
java.lang.IllegalArgumentException - If the nextAlert is not null and nextDisplayable is null at the same time, or if the nextDisplayable is instance of Alert

paint

protected void paint(javax.microedition.lcdui.Graphics g)
implementation of abstract method

Specified by:
paint in class javax.microedition.lcdui.Canvas
Parameters:
g -

sizeChanged

protected void sizeChanged(int w,
                           int h)
repaints the screen whem a size has changed.

Overrides:
sizeChanged in class javax.microedition.lcdui.Canvas

getDisplay

protected javax.microedition.lcdui.Display getDisplay()
Gets the used display object

Returns:
display object

getNextDisplayable

protected javax.microedition.lcdui.Displayable getNextDisplayable()
Gets the next displayable

Returns:

getNextAlert

protected javax.microedition.lcdui.Alert getNextAlert()
gets the next alert

Returns:

switchToNextDisplayable

protected void switchToNextDisplayable()
switch to the next displayable (or alert)


switchToDisplayable

protected static void switchToDisplayable(javax.microedition.lcdui.Display display,
                                          javax.microedition.lcdui.Alert alert,
                                          javax.microedition.lcdui.Displayable displayable)
Switch to the given displayable and alert

Parameters:
display -
alert -
displayable -

showNotify

protected void showNotify()
sets value of previous displayable. Implementation should always call this super implementation when overriding this method

Overrides:
showNotify in class javax.microedition.lcdui.Canvas