set JavaFX Node Tree Focusable - Java JavaFX

Java examples for JavaFX:Node

Description

set JavaFX Node Tree Focusable

Demo Code


//package com.java2s;

import javafx.scene.Node;
import javafx.scene.Parent;

public class Main {
    public static void setNodeTreeFocusable(Node n, boolean focusable) {
        n.setFocusTraversable(focusable);
        if (n instanceof Parent) {
            Parent p = (Parent) n;/*from ww w.j  a v  a2  s.  c o m*/
            for (Node nn : p.getChildrenUnmodifiable()) {
                setNodeTreeFocusable(nn, focusable);
            }
        }
    }
}

Related Tutorials