javafxtreeviewdisabled-controldisclosure

JavaFX TreeView: remove expand / collapse button (disclosure node) & functionality


I want to have a TreeView that has all of its children permanently expanded, and I don't want the user to be able to expand or collapse any of the children.

To do this I've found that I need to do the following:

Even though the icon is no longer visible, it's still clickable. I don't see any way of filtering this; I only see ways to be able to respond to it after the fact.

Also, if I'm missing anything else that I need to do to ensure this functionality, please let me know.


Solution

  • I feel quite silly. I think this was mostly just a matter of not knowing what that darn arrow was called. Apparently it's a disclosureNode? Maybe that's common knowledge.

    In the custom defined TreeCell, all I did was add this line in the updateItem method:

    setDisclosureNode(null);