• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTreeTable ToolTip problem  RSS feed

 
Sebastiaan Kortleven
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I got the JTreeTable implementation of Sun (as used in their example(http://java.sun.com/products/jfc/tsc/articles/treetable2/index.html)) up and running.

Now I would like to add tooltips to the tree. So I create a custom cell renderer with the tooltip functionality. Now the tooltip only works on the root element of the tree.. the subelements do not show the tooltip..

I override the method like this:



Anyone else encountered this problem, or someone who know's how to fix this?

Thanks!
 
Terence Doyle
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

With most complex java components if you want a tool tip you need to overwrite the getToolTipText( MouseEvent e ) method and then register the component with the ToolTipManager


Example;




Hope that helps,
 
Sebastiaan Kortleven
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!

This is the code I subclassed the renderer (JTree) with:



Adding the jtree to the ToolTipManager made it all work..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!