The idea is quite simple: I have a JTree
consisting of different subclasses of TreeNode
.
The problem: How do I allow the user to select only nodes of type XyNode
?
I have thought of just adding a TreeSelectionListener
and deselecting any "wrong" nodes the user might select, but it seems quick & dirty.
Writing my own TreeSelectionModel
came to mind, but the interface doesnt seem to be meant for the job.
Anyone got experience or a good solution for this?