Skip to main content

Some issues/feedback from my first attempts with LWUIT

3 replies [Last post]
xwatch
Offline
Joined: 2007-08-14

Hi,
I started to look at LWUIT and wrote a simple midlet to see how it works.
I tested my midlet on Nokia 6300 and HP Ipaq 614c.
I'm having issues on both phones.

On Nokia 6300 no text is rendered usind the bitmap font. I know this is a known issue. I tried also LWUITDemo on that phone and it works fine.

On HP Ipaq there is a white space at the bottom of the screen. The space height is the difference between fullscreen and no fulscreen height.

After I start the app i see the exit command for a short moment above the white space.
But then it dissapears (or just hides behind the white space). Because the command functionality remains, so when I click on the place in the white space where the command is supposed to be it works and exits the midlet.

I tried the LWUITDemo and it also has the white space at the bottom of the screen.
Clicking hidden commands or buttons works.

Here is my source code:

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package org.evolution.mobile.lwuittest;

import com.sun.lwuit.Command;
import com.sun.lwuit.Component;
import com.sun.lwuit.Display;
import com.sun.lwuit.Font;
import com.sun.lwuit.Form;
import com.sun.lwuit.Label;
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.events.ActionListener;
import com.sun.lwuit.layouts.BoxLayout;
import com.sun.lwuit.plaf.Style;
import com.sun.lwuit.util.Resources;
import java.io.IOException;
import javax.microedition.midlet.*;

/**
* @author ine
*/
public class LWUITMidlet extends MIDlet implements ActionListener {

private Command exitCommand = new Command("Exit", 1);

public void startApp() {
Display.init(this);

Font font = null;
Resources fontResource = null;

try {
fontResource = Resources.open("/font.res");
} catch (IOException ex) {
ex.printStackTrace();
}

if (fontResource != null) {
font = fontResource.getFont("BitmapFont");
} else {
font = Font.getDefaultFont();
}

Style formStyle = new Style();
formStyle.setBgColor(0x666666);
formStyle.setFgColor(0xFFFFFF);
formStyle.setMargin(0, 0, 0, 0);
formStyle.setPadding(0, 0, 0, 0);
formStyle.setFont(font);

Style titleStyle = new Style();
titleStyle.setBgColor(0x000000);
titleStyle.setFgColor(0xFFFFFF);
titleStyle.setMargin(0, 0, 0, 0);
titleStyle.setPadding(2, 2, 2, 2);
titleStyle.setFont(font);

Form form = new Form("Title");
form.setStyle(formStyle);
form.setTitleStyle(titleStyle);
form.setBorderPainted(false);
form.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

Label label = new Label("Label");
label.setAlignment(Component.CENTER);
label.setBorderPainted(false);

Style labelStyle = new Style();
labelStyle.setBgColor(0x999999);
labelStyle.setFgColor(0xFFFFFF);
labelStyle.setMargin(0, 0, 0, 0);
labelStyle.setPadding(0, 0, 0, 0);
labelStyle.setFont(font);

label.setStyle(labelStyle);

form.addComponent(label);
form.addCommand(exitCommand);
form.setCommandListener(this);
form.setSoftButtonStyle(titleStyle);

form.show();
}

public void pauseApp() {

}

public void destroyApp(boolean unconditional) {

}

public void actionPerformed(ActionEvent actionEvent) {
if (actionEvent.getCommand() == exitCommand) {
notifyDestroyed();
}
}
}

Message was edited by: xwatch

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Shai Almog

Hi,
> On Nokia 6300 no text is rendered usind the bitmap font. I know
> this is a known issue. I tried also LWUITDemo on that phone and it
> works fine.

While it is a known issue we weren't able to reproduce it
consistently. I had this issue in a simulator for a while only to
have it go away and come back later on, really weird.
So if anyone has a consistent SIMPLE test case that would be very
helpful for this issue, ideally something reproducible in the Nokia
simulator (which I was able to do in the past).
Technically bitmap fonts are only images painted with clipping so I
assume the Nokia device has a clipping bug but I have no idea what it
might be and how we can possibly work around it?

> On HP Ipaq there is a white space at the bottom of the screen. The
> space height is the difference between fullscreen and no fulscreen
> height.

We saw this issue in the past on an HTC device but we don't have such
a device for testing so we can't determine the cause for this or if
there is a valid workaround. We would be very happy for any tips in
that direction and debugging information from the community.
Hopefully when the source will be available this will be easier on to
debug.

Thanks,
Shai.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

xwatch
Offline
Joined: 2007-08-14

Hi,
I installed - Series 40 5th Edition SDK from Nokia (http://www.forum.nokia.com/info/sw.nokia.com/id/cc48f9a1-f5cf-447b-bdba-...)
and ran the app in the emulator. It behaves exactly like my real device (Nokia 6300), so I don't see text rendered using bitmap font.

May be that can help.
I'm using Netbeans 6.1 IDE.

Shai Almog

Hi,
a reproducible test case would help in tracking this down and if you
are aware of any outstanding Nokia clipping/image bugs that too will
help.

Thanks,
Shai.

> Hi,
> I installed - Series 40 5th Edition SDK from Nokia (http://
> www.forum.nokia.com/info/sw.nokia.com/id/cc48f9a1-f5cf-447b-bdba-
> c4d41b3d05ce/Series_40_Platform_SDKs.html)
> and ran the app in the emulator. It behaves exactly like my real
> device (Nokia 6300), so I don't see text rendered using bitmap font.
>
> May be that can help.
> I'm using Netbeans 6.1 IDE.
> [Message sent by forum member 'xwatch' (xwatch)]
>
> http://forums.java.net/jive/thread.jspa?messageID=283013
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net