java-melwuitlwuit-formlwuit-textarealwuit-container

Prevent last component of LWUIT form from losing focus when down arrow key is pressed


I have a lwuit Form to which I have added a Container. The Container has a TextArea, some RadioButtons and finally another Container which has some Buttons.

1)TextArea
2)RadioButtons
3)Another Container with some Buttons

Now if the focus is on my last Container on the Form and I press the 'down arrow key' the focus jumps to the first component TextArea .

Likewise, if the focus is on my first Container on the Form TextArea and I press the 'up arrow key' the focus jumps to the last component of the Form.

This is very annoying. How do i prevent this from happening?

So incase the focus is on the first Container of the Form TextArea...I want the focus to remain on TextArea even if the 'up arrow' key is press.


Solution

  • You can solve that issue using the Form's method setCyclicFocus(boolean cyclicFocus). Just put this value to false. So, use Form.setCyclicFocus(false)