0
votes

I created context menu for TreeView Node but I face a problem how I can create context menu for different tree nodes?

enter image description here

Is there any way to solve this?

2

2 Answers

2
votes

See https://www.marshall.edu/genomicjava/2013/12/30/javafx-tableviews-with-contextmenus/ which does something similar for TableViews. You can adapt the ideas there to work with a TreeView.

2
votes

You can define a custom TreeCell factory on your TreeView. This custom factory will build a custom TreeCell, and, this custom cell can define the context menu as expected.

This answer shows how to create these custom pieces of building blocks :-).