hello,
I am using a JTree with a custom model (tree nodes are domain objects,
not DefaultMutableTreeNodes).
in my TreeCellRenderer's getTreeCellRendererComponent method,
I create a DefaultTreeCellRenderer:
DefaultTreeCellRenderer TCR = new DefaultTreeCellRenderer();
modify layout properties, add a Tooltip:
TCR.setToolTipText("hello world");
and pass the arguments to its getTreeCellRendererComponent method:
return TCR.getTreeCellRendererComponent(tree, value, selected,
expanded, leaf, row, hasFocus);
Unfortunately, the tooltips don't show up in the GUI.
Do you have any hints?
Thanks in Advance!

Signature
Felix Natter
Java coder - 06 Feb 2010 14:38 GMT
Felix Natter a écrit :
> hello,
>
[quoted text clipped - 18 lines]
>
> Do you have any hints?
Yes, you need to register the JTree to the shared tooltip manager. And
BTW, you shouldn't create a new renderer for each call of
getTreeCellRendererComponenet, see JTree.setCellRenderer.
Felix Natter - 06 Feb 2010 21:47 GMT
> Felix Natter a écrit :
>> hello,
[quoted text clipped - 21 lines]
>
> Yes, you need to register the JTree to the shared tooltip manager.
Thanks, this works.
> And BTW, you shouldn't create a new renderer for each call of
> getTreeCellRendererComponenet, see JTree.setCellRenderer.
I guess I should save the TCR as an instance in my model.
Thanks!

Signature
Felix Natter