Skip to main content

Focus change with TextField exception

3 replies [Last post]
markww
Offline
Joined: 2006-03-20

Hi,

I'm developing for blackberry. I have the latest version of LWUIT running, looks good. I tried making two TextFields on one form. I believe I need to set them as using qwerty mode. When I try changing focus between them using the arrow keys, the midlet will randomly crash. To test this, as soon as my midlet starts up, I just hold the arrow key down, toggling focus, until the midlet throws a null pointer exception, originating from LWUIT. The most info I have on it that JDE gives me is the last calling method:

Form.updateFocus(int) Line 1347

Below is my midlet:

<br />
package TestMyLWUIT;</p>
<p>import java.util.*;<br />
import java.io.*;<br />
import javax.microedition.midlet.*;<br />
import javax.microedition.lcdui.*;<br />
import java.lang.*;</p>
<p>import com.sun.lwuit.Command;<br />
import com.sun.lwuit.Component;<br />
import com.sun.lwuit.Container;<br />
import com.sun.lwuit.Display;<br />
import com.sun.lwuit.Form;<br />
import com.sun.lwuit.Label;<br />
import com.sun.lwuit.TextField;<br />
import com.sun.lwuit.events.ActionEvent;<br />
import com.sun.lwuit.events.ActionListener;<br />
import com.sun.lwuit.geom.Dimension;<br />
import com.sun.lwuit.layouts.BoxLayout;<br />
import com.sun.lwuit.plaf.UIManager;<br />
import com.sun.lwuit.util.Resources;<br />
import java.io.IOException;<br />
import java.io.InputStream;</p>
<p>public class TestMyLWUITMidlet extends MIDlet<br />
{<br />
    private static Form mainMenu;<br />
    private int cols;<br />
    private int elementWidth;</p>
<p>    public TestMyLWUITMidlet()<br />
    {<br />
    }</p>
<p>    public void startApp()<br />
    {<br />
        Display.init(this);</p>
<p>        // Load the resource file from the jar here.<br />
        Resources res;<br />
        try {<br />
            InputStream is = getClass().getResourceAsStream("/res/test1.res");<br />
            res = Resources.open(is);<br />
            UIManager.getInstance().setThemeProps(res.getTheme(res.getThemeResourceNames()[0]));<br />
        }<br />
        catch (Exception ex) {<br />
            System.out.println("Error: " + ex.toString());<br />
            ex.printStackTrace();<br />
            return;<br />
        }</p>
<p>        // Main form.<br />
        mainMenu = new Form("My LWUIT Demo") {<br />
            public void setSize(Dimension d) {<br />
                if (cols != d.getWidth() / elementWidth) {<br />
                    System.out.println("not good...");<br />
                }<br />
                super.setSize(d);<br />
            }<br />
        };<br />
        mainMenu.setLayout(new BoxLayout(BoxLayout.Y_AXIS));</p>
<p>        TextField editEmail = new TextField(15);<br />
        editEmail.setQwertyInput(true);</p>
<p>        TextField editPassword = new TextField(15);<br />
        editPassword.setQwertyInput(true);</p>
<p>        Container mainContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));<br />
        mainContainer.addComponent(editEmail);<br />
        mainContainer.addComponent(editPassword);<br />
        mainMenu.addComponent(mainContainer);<br />
        mainMenu.show();<br />
    }</p>
<p>    public void pauseApp()<br />
    {<br />
    }</p>
<p>    public void destroyApp(boolean unconditional)<br />
    {<br />
    }<br />
}<br />

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
markww
Offline
Joined: 2006-03-20

Is there anymore info I can get about this to help diagnose the problem?

Last time I checked, the LWUIT source code wasn't available, so I can't step debug to find out for myself,

Thanks

chen

Hi,
We would appreciate any help in such issues, thanks.
The code will be publish very soon, so your help here would be great.

Thanks,
Chen

lwuit-users@mobileandembedded.org wrote:
> Is there anymore info I can get about this to help diagnose the problem?
>
> Last time I checked, the LWUIT source code wasn't available, so I can't step debug to find out for myself,
>
> Thanks
> [Message sent by forum member 'markww' (markww)]
>
> http://forums.java.net/jive/thread.jspa?messageID=288378
>
> ---------------------------------------------------------------------
> 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

markww
Offline
Joined: 2006-03-20

Yeah I would certainly help debug/recommend a fix - any estimate as to when the source will be released - is very soon a week, a month?

Thanks