0

For my JTree I have a custom DefaultTreeCellRenderer which overrides the getTreeCellRendererComponent method. This allows me to define custom icons for the tree nodes. If I call setToolTipText in my renderer, the tooltip gets displayed even if you just hover over the text. So my question is:
How can I make it so that the tooltip only gets displayed when you hover over the icon of the node.

FishyCode
  • 60
  • 8
  • 1
    Maybe override the `getToolTipText(...)` method to set the tool tip only when the mouse is over the Icon. Here is a basic example overriding this method: https://stackoverflow.com/questions/7138914/swing-how-to-create-a-custom-jtooltip-like-widget-that-moves-with-the-mouse/7139057#7139057 – camickr Nov 21 '21 at 14:46
  • @camickr Thats an interesting approach I haven't yet considered. I'll certainly try it. – FishyCode Nov 21 '21 at 15:11

0 Answers0