Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In common case the navigation is done in a container order, in order of children, or according to arrow keys pressing. You can change order of nodes - it will be the optimal solution for you in this situation.</p> <p>There is a back door in JFX about traversal engine strategy substitution : </p> <p>you can subclass the internal class com.sun.javafx.scene.traversal.TraversalEngine</p> <pre><code>engine = new TraversalEngine(this, false) { @Override public void trav(Node owner, Direction dir) { // do whatever you want } }; </code></pre> <p>And use </p> <pre><code>setImpl_traversalEngine(engine); </code></pre> <p>call to apply that engine.</p> <p>You can observe the code of OpenJFX, to understand, how it works, and what you can do.</p> <p>Be very careful : it is an internal API, and it is likely to change, possibly, in the nearest future. So don't rely on this (you cannot rely on this officialy, anyway).</p> <p>Sample implementation : </p> <pre><code>public void start(Stage stage) throws Exception { final VBox vb = new VBox(); final Button button1 = new Button("Button 1"); final Button button2 = new Button("Button 2"); final Button button3 = new Button("Button 3"); TraversalEngine engine = new TraversalEngine(vb, false) { @Override public void trav(Node node, Direction drctn) { int index = vb.getChildren().indexOf(node); switch (drctn) { case DOWN: case RIGHT: case NEXT: index++; break; case LEFT: case PREVIOUS: case UP: index--; } if (index &lt; 0) { index = vb.getChildren().size() - 1; } index %= vb.getChildren().size(); System.out.println("Select &lt;" + index + "&gt;"); vb.getChildren().get(index).requestFocus(); } }; vb.setImpl_traversalEngine(engine); vb.getChildren().addAll(button1, button2, button3); Scene scene = new Scene(vb); stage.setScene(scene); stage.show(); } </code></pre> <p>It will require strong analitical skills for common case ;)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload