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. 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. > Please note, in previous version this component automatically switched to displayables specified by setNextDisplayable() method, but this approach has been deprecated in favor of using static command and calling CommandListener's commandAction() method when an action happens. This gives the developer much higher flexibility for processing the action - it is no longer limited to switching to another displayable, but it can do whatever developer wants.


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
AbstractInfoScreen(javax.microedition.lcdui.Display display, ColorSchema colorSchema)
          Creates a new instance of AbstractInfoScreen
 
Method Summary
 ColorSchema getColorSchema()
          Gets ColorSchema currently in use
protected  javax.microedition.lcdui.CommandListener getCommandListener()
          Gets command listener assigned to this displayable
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()
          Deprecated. - use static Commands and CommandListener pattern from the actual implementation class
protected  javax.microedition.lcdui.Displayable getNextDisplayable()
          Deprecated. - use static Commands and CommandListener pattern from the actual implementation class
 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 setColorSchema(ColorSchema colorSchema)
          Sets ColorSchema
 void setCommandListener(javax.microedition.lcdui.CommandListener commandListener)
          Sets command listener to this component
 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)
          Deprecated. - use static Commands and CommandListener pattern from the actual implementation class
 void setNextDisplayable(javax.microedition.lcdui.Displayable nextDisplayable)
          Deprecated. - use static Commands and CommandListener from the actual implementation
 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)
          Deprecated. - use SplashScreen.DISMISS_COMMAND or WaitScreen.SUCCESS_COMMAND in CommandListener.commandAction() to handle this event for specific implementation of the info screen.
protected  void switchToNextDisplayable()
          Deprecated. - use static Commands and CommandListener pattern from the actual implementation class
 
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, 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

AbstractInfoScreen

public AbstractInfoScreen(javax.microedition.lcdui.Display display,
                          ColorSchema colorSchema)
Creates a new instance of AbstractInfoScreen

Parameters:
display - display parameter. Cannot be null
colorSchema - color schema to be used for this component. If null, SystemColorSchema is used.
Throws:
java.lang.IllegalArgumentException - if the display parameter is null
Method Detail

getColorSchema

public ColorSchema getColorSchema()
Gets ColorSchema currently in use


setColorSchema

public void setColorSchema(ColorSchema colorSchema)
Sets ColorSchema


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

getCommandListener

protected final javax.microedition.lcdui.CommandListener getCommandListener()
Gets command listener assigned to this displayable

Returns:
command listener assigned to this component or null if there is no command listener assigned

setCommandListener

public void setCommandListener(javax.microedition.lcdui.CommandListener commandListener)
Sets command listener to this component

Overrides:
setCommandListener in class javax.microedition.lcdui.Displayable
Parameters:
commandListener - - command listener to be used

setNextDisplayable

public void setNextDisplayable(javax.microedition.lcdui.Displayable nextDisplayable)
Deprecated. - use static Commands and CommandListener from the actual implementation

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
Deprecated. - use static Commands and CommandListener pattern from the actual implementation class

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()
Deprecated. - use static Commands and CommandListener pattern from the actual implementation class

Gets the next displayable

Returns:
next displayable

getNextAlert

protected javax.microedition.lcdui.Alert getNextAlert()
Deprecated. - use static Commands and CommandListener pattern from the actual implementation class

gets the next alert

Returns:
next alert

switchToNextDisplayable

protected void switchToNextDisplayable()
Deprecated. - use static Commands and CommandListener pattern from the actual implementation class

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)
Deprecated. - use SplashScreen.DISMISS_COMMAND or WaitScreen.SUCCESS_COMMAND in CommandListener.commandAction() to handle this event for specific implementation of the info screen.

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