Hi all,

I've two questions-

First
In the j2me application suppose i've a list with no. of items. To select the item between 1 to 9, i can use 1 to 9 keys on keypad. Is thr any way such that i can select the list items after 9like 12 or 20. Means when i press 20 on keypad, list item 20 get selected...

&
Second
Can i apply scroll bar to ChoiseGroup in j2me? becoz, if i've 15 choise elements then the choise box will go down upto screen size, but i want to restrict it to 4 to 5 elements and rest of the elements will be seen with scroll.

plz reply...

Thanks..

Is thr any way such that i can select the list items after 9like 12 or 20. Means when i press 20 on keypad, list item 20 get selected...

Ofcourse you can do it. I do not know about other phones but my current Sony Ericsson w910 has contact list done this way. The idea is you have TextField on the top of the screen to which you have attached action listener notifyStateChanged(). As user press keys, you listen for change, read user entry, compute what value you get and do something, like in your case if first is num 1 it will jump to first entry however if user add num 2 after it it will jump to 12. Do not forget you can specify what input is expected in the text field

TextField(String label, String text, int maxSize, int constraints)

Can i apply scroll bar to ChoiseGroup in j2me? becoz, if i've 15 choise elements then the choise box will go down upto screen size, but i want to restrict it to 4 to 5 elements and rest of the elements will be seen with scroll.

I'm not sure what you tried but following works fine for me

String options[] = {"Home", "Mobile", "Office", "Other","Home2", "Mobile2", "Office2", "Other2", "Home3", "Mobile3", "Office3", "Other3", "Home4", "Mobile4", "Office4", "Other4"};
ChoiceGroup phoneType = new ChoiceGroup("Select Option:", Choice.POPUP, options, null);

See attachment

Hi peter_budo
Thnaks for reply..

About first reply---
I m using Nokia 6600 device..
Currently I can access list items upto 9 by pressing key on keypad.. but i've not written any code for that..it means there is some setting or code which will automatically generated.. and it'll work for any device, nokia or sony or LG.
I m using NetBeans for developing applications.

So is there any possiblity whr i can get such code or setting..
Othervise ur way is fine.

And about second..
ur choise Group height is same as screen height. i want to fix that height, so that i can see only 3-4 elements and rest can be seen after scrolling within ChoiseGroup..


thanks..

Currently I can access list items upto 9 by pressing key on keypad.. but i've not written any code for that..it means there is some setting or code which will automatically generated.. and it'll work for any device, nokia or sony or LG.
I m using NetBeans for developing applications.

So is there any possiblity whr i can get such code or setting..
Othervise ur way is fine.

That is the only way how to do it beside touching/accessing underlying mobile device OS
IDE doesn't matter, if somebody will make me angry I can do coding in simple text editor (like notepad) and compile on command prompt

And about second..
ur choise Group height is same as screen height. i want to fix that height, so that i can see only 3-4 elements and rest can be seen after scrolling within ChoiseGroup..

Not possible, J2ME has no equivalent to J2EE's JComboBox.setMaximumRowCount(int count)

ok..

Thnks a lot for reply...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.