2

I want to design one form that contains TextField and ListView in J2ME. But I don't know how to create this form. It is looked like Dictionary Form. Could anybody help me to do that?

gnat
  • 6,213
  • 108
  • 53
  • 73
Sopolin
  • 576
  • 5
  • 15
  • 26

1 Answers1

0

You can't really do that with the basic UI controls in MIDP.

List can't contain TextField.

I would suggest looking at LWUIT since it has better controls.

Otherwise, if you don't need to display Images in your List, then you can use a Form containing both TextField and StringItem. Unfortunately, an ItemStateListener added to the Form will probably not give you as much information as a List.

Implementing the list yourself in a CustomItem means writing quite a bit of code but is doable.

If what you need is a TextField where you enter a search String and a List that displays the search result, I suggest using a TextBox first, then a List. Separate screens are by far the quickest solution here.

Edit: you can't use swing in j2me. what you can do is have just a textfield in a form, then add/remove StringItems to/from the Form when the user changes the content of the TextField. You should be able to rely on ItemStateListener to tell you when the textfield content changes.

michael aubert
  • 6,836
  • 1
  • 16
  • 32
  • Hi, I understand what you said. But I want to a form that contain a text to type and the list will be show the word that I type in the text. If I use tableItem with text field, is it ok? – Sopolin Aug 29 '09 at 01:10
  • Hi, if I want to use swing interface with j2me, can I ? – Sopolin Aug 31 '09 at 02:36
  • I also have the same problem. But I'm implementing checkboxes using CustomItem. I want the user interface to be the same as the Nokia's phonebook application. – jean27 Aug 16 '10 at 05:48