• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

JTreeTable ToolTip problem

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
The moustache of a titan! The ad of a flea:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic