JavaFX provides an easy way to implement Java GUIs. Unfortunately, some methods or concepts are missing.

I used a TreeView component with CheckBoxTreeItems. When evaluating the input I want to get all checked items from the TreeView, resp. its SelectionModel.

The standard method getSelectedItems just returns the selected items, when selecting means the last clicked (i.e. selected) element.

Thus I had to write my own code for traversing the tree and collecting all checked elements. This is not difficult, but a bit tiresome, as there are many methods missing that have to be implemented.

If you’re interested in the code, see

for my implementation. As I state in the documentation, using Kotlin should provide means to extend the TreeView class itself, but this is future talk.

Related Posts

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.

72 + = 76