How to search JavaFX TreeView for next TreeItem?

Viewed 1821

I would like to setup some search functionality so that when you type text into a TextField and press enter it finds the first instance of that String in a TreeView. Then, when you press enter again, it will finds the second instance, pressing it again will find the third, ect...

It doesn't seem too hard to be able to search a TreeView and find the first TreeItem containing text, but I am unsure how to then keep searching down the TreeView for other TreeItems containing said text. I imagine to search through all the Folders/Documents inside a TreeView would require some sort of recursive function, but am unsure. I would therefore like to ask if anyone might be able to provide an example or some tips of how to create this search functionality. Any help would be appreciated :)

Drew

1 Answers
Related