is Child Of JavaFX Node - Java JavaFX

Java examples for JavaFX:Node

Description

is Child Of JavaFX Node

Demo Code


//package com.java2s;

import javafx.scene.Node;

public class Main {
    public static boolean isChildOf(Node child, Node parent) {
        if (child == null || parent == null) {
            return false;
        } else if (child == parent) {
            return true;
        } else {// w w w.j a  va 2 s .  co m
            Node p = child.getParent();
            return p == null ? false : isChildOf(p, parent);
        }
    }
}

Related Tutorials