I have a JTree populated with some (custom) nodes. I have a class that’s subclass of DefaultTreeCellRenderer and using that “MyTreeCellRenderer” i can set tooltips for each node in my tree. It works fine: JTree is populated, cell renderer is set, all added nodes do have tooltips.
Problem is that i don’t know how to change tooltip for certain node in already populated tree… How to do that? Is there any way to “recreate” cell renderer for just one node in JTree?
I have a JTree populated with some (custom) nodes. I have a class that’s
Share
I did it! Instead of using extended CellRenderer i used “getTooltipText” method of tree (i extended the tree). That way i was able to control text of tooltip according to object that has mouse pointer over it.
You will also need to tell the tooltip manager about your tree before the tooltips will render: