In JavaFX, from within node A, is it possible to transfer the focus to the next focusable node, node B?
Asked
Active
Viewed 1,043 times
4
-
Look at this : http://stackoverflow.com/questions/15238928/javafx-change-focus-traversal-policy/15250149#15250149 – Alexander Kirov Jul 20 '13 at 05:25
-
Thanks Alexander, but if I understand the link, that is solving a node ordering problem. In this case, node B already correctly follows node A as defined by the default focus traversal policy. My question is from within the handler code of node A, can I signal a transfer to the next node. – JDawg Jul 20 '13 at 20:28
-
I think, there are two ways: a) get engine, and call it; b) simulate sending "tab" key pressing on the node. As far as I know, there is no direct API for transfer on a next node – Alexander Kirov Jul 21 '13 at 05:19
1 Answers
1
You can use Node's method impl_traverse to set focus on next focusable Node:
A.impl_traverse(Direction.NEXT)
or in JavaFX 8:
new KeyboardShortcutsHandler().traverse(A, Direction.NEXT)

7er
- 26
- 1