• Post Reply Bookmark Topic Watch Topic
  • New Topic

ToolTip doesn't work after adding to JPanel  RSS feed

 
Albert Schweitzer
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,
I hope someone can help me. Please ignore my awful
english!
This is my problem:
I wrote a CommentTriangle-Class which inherits from JComponent.
It's intention is to give the info that a table-column has some comments.
When the mouse-cursor moves over the triangle,
the comments should show up.
What I do in the code of the class is to draw a triangle(paint-method) and to set the toolTipText(constructor).
How far did I get? The ToolTip of the CommentTriangle works fine,
when my TableCellRenderer delivers the triangle back without a panel.
But I want a label and other stuff to be displayed in the table cell also.
So I've put the Triangle in a JPanel.
Now the ToolTip is non-working!
Do you have any hints for me?
Thanks in advance!
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the JPanel the TableCellRenderer? Override the JPanel's getToolTipText() method to call the getToolTipText() method of the triangle inside it.

You may also need to call setToolTipText() on the JPanel before it will let you launch a tooltip... (like in the constructor call setToolTipText( "" ); )
[ March 19, 2003: Message edited by: Nathan Pruett ]
 
Albert Schweitzer
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your reply!
This gives me an interesting idea!
(which can maybe lead me also to an solution for
a different problem) :roll:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!