Skip to main content

How to determine which Component gets focus next in a Form?

2 replies [Last post]
chhjelm
Offline
Joined: 2009-02-26

In a Form I have a Container with various components. Inside the Container I take manual control of the focus (using setHandlesInput(true)) but when I'm finished and exits the Container using GAME_FIRE, I would like the focus to move to the next Component in the Form - as if the user had pushed GAME_DOWN or GAME_RIGHT.

I haven't found any way of doing is - anybody has some ideas?

Kind regards,
Christian

Reply viewing options

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

Use Component.setNextFocus*(Component);
> In a Form I have a Container with various components. Inside the Container I take manual control of the focus (using setHandlesInput(true)) but when I'm finished and exits the Container using GAME_FIRE, I would like the focus to move to the next Component in the Form - as if the user had pushed GAME_DOWN or GAME_RIGHT.
>
> I haven't found any way of doing is - anybody has some ideas?
>
> Kind regards,
> Christian
> [Message sent by forum member 'chhjelm' (chhjelm)]
>
> http://forums.java.net/jive/thread.jspa?messageID=341735
>
> ---------------------------------------------------------------------
> 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

juliofabio
Offline
Joined: 2009-02-10

Sample 1: (all components are TextField)
userName.setNextFocusUp(enterButton);
userName.setNextFocusLeft(enterButton);
userPass.setNextFocusDown(enterButton);
userPass.setNextFocusRight(enterButton);

Sample 2:
MyContainer.getComponentForm().setFocused(myNewFocusComponent);

Hope helped!

JFoc[b][/b][b][/b][b][/b]