Javafx 2 TreeView - hide root item

Muki picture Muki · Jul 20, 2012 · Viewed 7.9k times · Source

I created my own TreeView in JavaFX 2 with this tutorial. However I want to hide my root node.

How it looks like right now:

  • Root element
    • Parent 1
      • Child 1
      • Child 2
    • Parent 2
      • Child 1

How it should look:

  • Parent 1
    • Child 1
    • Child 2
  • Parent 2
    • Child 1

thanks, Muki

Answer

Uluk Biy picture Uluk Biy · Jul 20, 2012

Hiding the root item can be done by

treeView.setShowRoot(false);