java - How do I get all nodes in a scene in JavaFX? -
In C #, I found a way that was pretty sweet, from which you control all the tribes and all their descendants.
I am looking for a similar method for Java FX.
I have seen that the
This is what I have done so far (and I actually did not find anything on Google with "JavaFX finding all the nodes from one view"):
Public Fixed Arrestist & lt; Node & gt; GetAllNodes (Generate Route) {ArrayList & lt; Node & gt; Descendents = new ArrayList & lt; & Gt; (); Root.getChildrenUnmodifiable (). Stream (). For every (n -> (Descendents.contains (N)) Descendents.add (N); if (N.getClass () == Parent.class) Descendents.addAll (GetAllNodes (guardian))) ;}); }
So how would I tell that N is a parent (or extended by parents)? Am I doing this right? It is not working ... This root (parent) is in grabbing all the nodes from the node, but not with the children in the nodes. I think there is something like that probably got the answer but I'm just asking questions ... wrong. How can I go about doing this?
public static array list & lt; Node & gt; GetAllNodes (Generate Route) {ArrayList & lt; Node & gt; Nodes = new arrelisted & lt; Node & gt; (); AddAllDescendents (Routes, Nodes); Return nodes; } Private static zero addAllDescendents (parent, ArrayList & nt; node & node) nodes {for (node node: parent.getChildrenUnmodifiable ()) {nodes.add (node); If (parent node example) addAllDescendents ((parent) nodes, nodes); }}
Comments
Post a Comment