J2ME Polish
J2ME Polish 2.4 Documentation
Enough Software


You can use the ScreenInfo class to show status information consistently over all the screens of your application.


In the above example we use several images for displaying the online status of the user. The design is easy using the default screeninfo style:

screeninfo {
	margin-top: -24;
	margin-left: 10;

The ScreenInfo class uses internally an IconCustomItem for visualization. Please refer to that item's documentation for more information about design options.


You need to activate the usage of the ScreenInfo element by setting the "polish.ScreenInfo.enable" variable to "true" in your build.xml script:

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


Since there is only a single ScreenInfo element that spans over all screens of your application, all you need to modify your ScreenInfo element are static methods of the ScreenInfo class.

In the default mode the ScreenInfo element allows the setting of the text (ScreenInfo.setText(String)) and image (ScreenInfo.setImage(Image)) that should be displayed. You can also toggle the visibility by calling ScreenInfo.setVisible( boolean ). The following example exchanges the image of the ScreenInfo depending on the online status of the user:

private void setStatus( int status ) {
	String url;
	switch (status) {
	case STATUS_ONLINE: url = "/info_online.png"; break;
	case STATUS_INVISIBLE: url = "/info_invisible.png"; break;
	default: url = "/info_offline.png";
	//#if polish.ScreenInfo.enable
		try {
			Image img = Image.createImage(url);
			ScreenInfo.setImage( img );
		} catch (IOException e) {
			//#debug error
			System.out.println("Unable to switch to status " + status + ": " + url + " could not be loaded" + e );
		//#debug info
		System.out.println("status set to " + status  );

For changing the design, you can also use the #style preprocessing directive when calling ScreenInfo.setText(String) or ScreenInfo.setImage(Image):

//#style statusAccessDenied
ScreenInfo.setText("Not Allowed!");

You can also directly change the fontcolor and the background of the ScreenInfo element by calling ScreenInfo.setFontColor(int) and ScreenInfo.setBackground( Background ). This usage is, however, not recommended.

You can use any GUI item including your own CustomItem as a ScreenInfo element by calling ScreenInfo.setItem( Item ). Remember that you must not call any of the text- or image-related methods of the ScreenInfo element afterwards, since these require the usage of an IconItem internally.

How to realize a busy indicator with ScreenInfo

You can use ScreenInfo as an busy indicator, for example by using an animated gauge.
busy indicator
Necessary steps are:

  • register the polish.ScreenInfo.enable preprocessing variable: <variable name="polish.ScreenInfo.enable" value="true" />
  • Create a gauge in the code and use this in ScreenInfo:
    //#style busyGauge
    Gauge busyGauge = new Gauge(null, false, Gauge.INDEFINITE, Gauge.CONTINUOUS_RUNNING );
  • Enable and disable this gauge by calling start() and stop() methods at the beginning and end of long running processes:
    private synchronized void startBusyIndicator() {
    	if (this.busyIndicators == 0) {
    	System.out.println("start busy indicator: Number of busy indicators: " + this.busyIndicators);
    private synchronized void stopBusyIndicator() {
    	if (this.busyIndicators > 0) {
    		if (this.busyIndicators == 0) {
    	System.out.println("stop busy indicator: Number of busy indicators: " + this.busyIndicators);
  • Design the busy indicator gauge in the polish.css file:
    .busyGauge {
    	padding-top: 9px;
    	padding-left: 1px;
    	view-type: gauge-images;
    	gauge-images-sources: busy01.png,busy02.png,busy03.png,busy04.png,busy05.png,busy06.png,busy07.png,busy08.png,busy09.png,busy10.png,busy11.png,busy12.png;
    	gauge-images-interval: 100;
  • Since by default the ScreenInfo element is shown at the top left of the screen (unless you specify otherwise in the screeninfo style), you might want to ensure that the title is at least as hight as the busy indicator images:
    title {
    	padding: 2px;
    	font-size: large;
    	font-style: bold;
    	font-color: fontColor;
    	background-color: bgColor;
    	border: none;
    	layout: horizontal-center | horizontal-expand;
    	layout: center | vertical-center | expand;
    	min-height: imageheight( busy01.png );

The blank sample app contains all necessary resources and code for the busy indicator.

ScreenInfo Sample Apps

  • blank: demonstrates a busy indicator
  • mail: uses images for indicating online/offline mode



back to top