I have a TreeView
of a file hierarchy and I want know when the user clicks on one of the items so that I can open that file in tab. This question has already been asked before, but:
- it is from 2013, so the answers may be outdated (even though the accepted one isn't)
- Simply adding a MouseListener is not enough for me, since users should be able to trigger the action using the keyboard as well as with the mouse
The documentation states I should add my listener to a custom TreeCell
, but that class provides no listener methods, so I don't know how to go on from there. I am fine with answers that don't use TreeView
, if there are any good alternatives.