JTree How to prevent selection of Tree node
Posted on 2005-04-25
I have a JTree and I dont want to disable nodes.
In certain circumstances I would like to perform the following:
When the user clicks on a particular node (other than the currently selected one),
I want to prevent selection of that node and pop up a warning message.
(The warning message is not the issue)
The tree node selection must not change to the clicked one. The original
selected node must remain selected.
Presumably, I could reselect the originally selected node after closing the popup,
but it wouldn't look so good.
The selection process appears to take place before any mouse events are caught
by the listener.