I'm trying to change the background of a treeNode to get a hovering effect on mouseOver(); evrything seems to work so far...except I'm updating my whole tree UI; this is causing flickering of my cursor.
Is there another way of changing the background of tree node without whole tree updateUI() ?
I would appreciate any suggestions/solutions/workarounds.
Actually your solution is neat especially if selections are based on MouseMotions. I should have been clearer in my problem description and saved you some trouble.
Unfortunately my tree is bit more complicated: 1> I select a node only on single click; I have TreeSelectionListener there 2> I do something more on double-Click; so I need a MouseAdapter 3> I need a hovering effect under drag & drop; I dont want to select the node unless the actual drop happens
Nevertheless I found tree.getRowForLocation(e.getX(), e.getY() helpful ; I realized that the rectangle sorrounding a path can be found using getPathBounds.
Hope it helps somebody looking to achieve a hovering Effect.
[ August 30, 2005: Message edited by: Ravi Sathish ] [ August 30, 2005: Message edited by: Ravi Sathish ]
subject: Whats the best way to change background of treeNode in JTree