Skip to main content

textfield operation

5 replies [Last post]
vuqpham
Offline
Joined: 2008-06-13
Points: 0

How am I supposed to use the TextField ?

I add the TextField into a form. When I type something, it does not appear in the textfield. But when I select the softkey and select T9, a textarea appears for about one second with all the keys I typed in , then it disappears. And after that, the textfield still shows nothing.

Thanks for your advice.

Vu

Reply viewing options

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

Hi Vu,
which device/simulator are you using?

Is the text field sized correctly?

Did you place it in a layout that gives it room to display elements?

Is it possible you press T9 twice?

If you can reproduce this problem with sample code that would be very
helpful.

Thanks,
Shai.

> How am I supposed to use the TextField ?
>
> I add the TextField into a form. When I type something, it does not
> appear in the textfield. But when I select the softkey and select
> T9, a textarea appears for about one second with all the keys I
> typed in , then it disappears. And after that, the textfield still
> shows nothing.
>
> Thanks for your advice.
>
> Vu
> [Message sent by forum member 'vuqpham' (vuqpham)]
>
> http://forums.java.net/jive/thread.jspa?messageID=280723
>
> ---------------------------------------------------------------------
> 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

vuqpham
Offline
Joined: 2008-06-13
Points: 0

I think this is a bug - I may be wrong as I often am, please correct me.

With the below code :

Display.init(this);
Form f = new Form("Hello, LWUIT!");
GridLayout gl = new GridLayout(5,2);
f.setLayout(gl);
Label labelUser = new Label("User: ");
TextField user = new TextField(50);
user.setPreferredW(100);
f.addComponent(labelUser);
f.addComponent(user);
f.show();

Nothing will display in TextField when I type something.
When I get rid of the GridLayout, or change the GridLayout to one column, then the typing text displays in the TextField.

Could anyone test this and let me know if you experience the same problem ?

Thanks,
Vu

Shai Almog

Hi Vu,
Yes this is indeed a serious bug thanks for bringing it my attention!

> I think this is a bug - I may be wrong as I often am, please
> correct me.
>
> With the below code :
>
> Display.init(this);
> Form f = new Form("Hello, LWUIT!");
> GridLayout gl = new GridLayout(5,2);
> f.setLayout(gl);
> Label labelUser = new Label("User: ");
> TextField user = new TextField(50);
> user.setPreferredW(100);
> f.addComponent(labelUser);
> f.addComponent(user);
> f.show();
>
> Nothing will display in TextField when I type something.
> When I get rid of the GridLayout, or change the GridLayout to one
> column, then the typing text displays in the TextField.
>
> Could anyone test this and let me know if you experience the same
> problem ?
>
> Thanks,
> Vu
> [Message sent by forum member 'vuqpham' (vuqpham)]
>
> http://forums.java.net/jive/thread.jspa?messageID=280760
>
> ---------------------------------------------------------------------
> 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

vuqpham
Offline
Joined: 2008-06-13
Points: 0

Hi Shai,

Thanks for checking. By the way, in TextField, if I press the key "-" in the keypad of the full keyboard ( which is the # key of the phone ), the app will display an alert asking "app-name wants to read from the local file system. Is it ok to read your files ? ". This happens with the DefaultColorPhone of the Sun WTK 2.5.2.

Under the LX225 of the Sprint WTK Powered by Sun ( that goes with NB6 ) the output pane shows :

java.io.IOException:
at com.sun.midp.io.j2me.file.Protocol.openInputStream(Protocol.java:319)
at com.sun.midp.io.j2me.file.Protocol.openInputStream(Protocol.java:288)
at r.a(+61)
at ax.b(+180)
at ar.b(+75)
at ar.b(+136)

Thanks,

By the way, I really like this toolkit. It converts my ugly apps to much nicer ones :)

Vu

vprise
Offline
Joined: 2003-11-07
Points: 0

Hi Vu,
this issue will be fixed in the next drop (logging code that shouldn't have been there). If you want to workaround it for now you can derive Form and override keyReleased as such:
public void keyReleased(int keyCode) {
if(keyCode != '#') {
super.keyReleased(keyCode);
}
}

Thanks,
Shai.

> Hi Shai,
>
> Thanks for checking. By the way, in TextField, if I
> press the key "-" in the keypad of the full keyboard
> ( which is the # key of the phone ), the app will
> display an alert asking "app-name wants to read from
> the local file system. Is it ok to read your files ?
> ". This happens with the DefaultColorPhone of the Sun
> WTK 2.5.2.
>
> Under the LX225 of the Sprint WTK Powered by Sun (
> that goes with NB6 ) the output pane shows :
>
> java.io.IOException:
> at
> com.sun.midp.io.j2me.file.Protocol.openInputStream(Pro
> tocol.java:319)
> at
> com.sun.midp.io.j2me.file.Protocol.openInputStream(Pro
> tocol.java:288)
> at r.a(+61)
> at ax.b(+180)
> at ar.b(+75)
> at ar.b(+136)
>
>
> Thanks,
>
> By the way, I really like this toolkit. It converts
> my ugly apps to much nicer ones :)
>
> Vu