Create a form in J2ME

I want to create one form containing TextField and ListView in J2ME. But I don't know how to create this form. It looks like a Dictionary. Can anyone help me to do this?

+2


source to share


1 answer


You cannot do this with the basic interface elements in MIDP.

The list cannot contain a TextField.

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

Otherwise, if you do not need to display "Images" in your list, you can use a form containing both a TextField and a StringItem. Unfortunately, the ItemStateListener added to the form probably won't give you as much information as the List does.



Injecting a list yourself into a CustomItem means writing some pretty little code, but it's doable.

If you need a TextField where you enter a search string and a list that displays the search result, I suggest using the TextBox first and then the list. Individual screens are by far the fastest solution.

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

0


source







All Articles