LWUIT Command buttons not always visible

2019-07-31 02:47发布

问题:

I've written a LWUIT app but every few times I run it in the builtin Netbeans J2ME emulator or the Nokia Series 40 emulator, the command buttons for the main page do not show up. If I hit the softkey for the second command to go the the help screen, then go back, the commands are visible. I setup my commands exactly according to the tutorial, with these few lines of code:

        Command exitCommand = new Command("Exit");
        f.addCommand(exitCommand);
        Command settingsCommand = new Command("Help/About");
        f.addCommand(settingsCommand);
        f.addCommandListener(this);

Is there some sort of bug in LWUIT 1.5 that I should be aware of? Since it works most of the time and it's such a simple bit of code, I don't know what coding problem might cause it. It is interesting however that, as of yet, it hasn't happened on any page except for the main page which loads when the application is first run.

回答1:

If you are adding the command button after f.show() , then this issue might come up. If it is so try giving f.show() after adding command button.



回答2:

We are not aware of such an issue. LWUIT 1.5 introduced allot of changes to the behavior of the commands e.g. command behavior & extensible MenuBar class. So it is quite possible that an issue has crept up related to this.

I suggest you follow this up in the LWUIT issue tracker if the problem can be reproduced.



标签: java-me lwuit