At 10:34 PM 6/12/2002 +0200, Matthias Kümpel wrote: >im using a custom TreeCellRender that extends the >javax.swing.tree.DefaultTreeCellRenderer. > >My getTreeCellRendererComponent( ... ) method looks like: > >super.getTreeCellRendererComponent( ... ); >... >setToolTipText( "Test" ); >... >return this; > > >But the ToolTipText isnt displayed on any node ... what am i doing wrong >? > > >Thanx in advance, >Matthias Kümpel > >P.S.: All other modifacations i make in my custom renderer like icons, >color, etc. are displayed correct.
A TreeCellRenderer's Component is used as a "rubber stamp". It is drawn in the location for each cell, but doesn't actually exist there. If you got a JTree's child components, none of them would be that Component your TreeCellRenderer (or any other TreeCellRenderer) returns. That's why all the cosmetic modifications you make (icons, color) show up fine, but any interaction (tooltips, and ActionListeners if you were to add that) does not. TableCellRenderers work the same way. It's done to reduce overhead, I think; if your JTrees and JTables contained a whole JComponent for every cell, the interface would be unacceptably slow. (Yeah, I know, a lot of people think Swing is slow in any case, but that's another can of worms.) You'll have to find a different way to customize the tooltip to each cell. I'm afraid I don't know of a way offhand, but at least now you know what the problem is. _______________________________________________ Swing mailing list [EMAIL PROTECTED] http://eos.dk/mailman/listinfo/swing