de.enough.polish.ui
Class ScreenInfo

java.lang.Object
  extended by de.enough.polish.ui.ScreenInfo

public class ScreenInfo
extends java.lang.Object

Can be used for displaying information on each screen. This needs to be enabled specifically by setting the "polish.ScreenInfo.enable" preprocessing variable to "true":

        <variable name="polish.ScreenInfo.enable" value="true" />
 

If you want to display text you can use the "screeninfo" style for designing this element. Alternatively you can use the setImage( Image, Style ) or setText( String, Style ) methods for changing the style during runtime like this:

 if (this.isOnline) {
    //#style online
    ScreenInfo.setText("on");
 } else {
    //#style offline
    ScreenInfo.setText("off");
 }
 

Copyright (c) Enough Software 2005 - 2008

 history
        07-Jun-2005 - rob creation
 

Author:
Robert Virkus, j2mepolish@enough.de

Field Summary
static Item item
           
 
Method Summary
static java.lang.String getText()
          Retrieves the text contents of the ScreenInfo element.
static boolean isVisible()
          Determines whether the ScreenInfo object should be painted.
static void paint(javax.microedition.lcdui.Graphics g, int titleHeight, int screenWidth)
          Paints this element.
static void setBackground(Background background)
          Sets a specific background.
static void setFontColor(int color)
          Sets a specific text color.
static void setImage(javax.microedition.lcdui.Image image)
          Sets the image for the screen info object.
static void setImage(javax.microedition.lcdui.Image image, Style style)
          Sets the image for the screen info object.
static void setItem(javax.microedition.lcdui.Item newItem)
          Sets the item that is painted on the screen.
static void setItem(Item newItem)
          Sets the item that is painted on the screen.
static void setItem(Item newItem, Style style)
          Sets the item that is painted on the screen.
static void setPosition(int x, int y)
          Sets the position of this ScreenInfo - if not set it will be painted on the left side below the title.
static void setScreen(Screen screen)
          Sets the screen which now uses the ScreenInfo element.
static void setText(java.lang.String text)
          Sets the text contents of the ScreenInfo.
static void setText(java.lang.String text, Style style)
          Sets the text contents of the ScreenInfo along with a style.
static void setVisible(boolean isVisible)
          Paddles the visibility of the ScreenInfo object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

item

public static Item item
Method Detail

setVisible

public static void setVisible(boolean isVisible)
Paddles the visibility of the ScreenInfo object.

Parameters:
isVisible - true when this element should be shown.

isVisible

public static boolean isVisible()
Determines whether the ScreenInfo object should be painted.

Returns:
true when the ScreenInfo item should be painted

setText

public static void setText(java.lang.String text)
Sets the text contents of the ScreenInfo.

Parameters:
text - the new text

getText

public static java.lang.String getText()
Retrieves the text contents of the ScreenInfo element.

Returns:
the current text of this screen info

setText

public static void setText(java.lang.String text,
                           Style style)
Sets the text contents of the ScreenInfo along with a style.

Parameters:
text - the new text
style - the new style, is ignored when null

setImage

public static void setImage(javax.microedition.lcdui.Image image)
Sets the image for the screen info object.

Parameters:
image - the image, when null is given, no image is painted.

setImage

public static void setImage(javax.microedition.lcdui.Image image,
                            Style style)
Sets the image for the screen info object.

Parameters:
image - the image, when null is given, no image is painted.
style - the new style of this item, is ignored when null

setItem

public static void setItem(javax.microedition.lcdui.Item newItem)
Sets the item that is painted on the screen. Warning: read doc! You can replace the standard item (it's an IconItem) with this method, you can even set your own custom item. You need to rememember that afterexchanging the item with a non IconItem, you cannot call setText and setImage anymore. (This is a dummy signature that is not used, since it accepts the javax.microedition.lcdui classses, the J2ME Polish build process will automatically convert this call to the correct one).

Parameters:
newItem - the item that is painted on the screen

setItem

public static void setItem(Item newItem)
Sets the item that is painted on the screen. Warning: read doc! You can replace the standard item (it's an IconItem) with this method, you can even set your own custom item. You need to rememember that afterexchanging the item with a non IconItem, you cannot call setText and setImage anymore.

Parameters:
newItem - the item that is painted on the screen

setItem

public static void setItem(Item newItem,
                           Style style)
Sets the item that is painted on the screen. Warning: read doc! You can replace the standard item (it's an IconItem) with this method, you can even set your own custom item. You need to rememember that afterexchanging the item with a non IconItem, you cannot call setText and setImage anymore.

Parameters:
newItem - the item that is painted on the screen
style - the new style of this item, is ignored when null

setPosition

public static void setPosition(int x,
                               int y)
Sets the position of this ScreenInfo - if not set it will be painted on the left side below the title.

Parameters:
x - the x coordinate
y - the y coordinate

setScreen

public static void setScreen(Screen screen)
Sets the screen which now uses the ScreenInfo element.

Parameters:
screen - the new screen or null when an old screen deregisters itself (hideNotify())

setBackground

public static void setBackground(Background background)
Sets a specific background. Usually not necessary, when this element is designed using the "screeninfo" style or the setImage( Image, Style ) method or the setText( String, Style ) method.

Parameters:
background - the new background.

setFontColor

public static void setFontColor(int color)
Sets a specific text color. Usually not necessary, when this element is designed using the "screeninfo" style or the setImage( Image, Style ) method or the setText( String, Style ) method.

Parameters:
color - the new font color.

paint

public static void paint(javax.microedition.lcdui.Graphics g,
                         int titleHeight,
                         int screenWidth)
Paints this element. This method is usually only called by the Screen implementation.

Parameters:
g - the graphics object
titleHeight - the height of the screen's title
screenWidth - the width of the screen