Why is getToolTipText never called?

I have a JComponent. The paintComponent method is overridden. I mentioned that tooltips were not reliable. Sometimes they were shown, but once they were not. Now I no longer see the hints on this component. I rewrote getToolTipText (MouseEvent e) to indicate the contents of the tooltips. But the getToolTipText () and getToolTipText (MouseEvent e) methods are never called!

What could be wrong here? What can I do to fix this?

+4
source share
4 answers

I believe that you will need to call ToolTipManager.registerComponent . This is apparently an optimization.

+3
source

You will need to register your component using the hint manager.

The default implementation of setToolTipText() will do this for you, but if you want to override getToolTipText() , you need to add this line somewhere in IE to the constructor of your component:

 ToolTipManager.sharedInstance().registerComponent(this); 
+3
source

Did you set the tooltip using the setToolTipText (String) method ??

If the tooltip is not set (or resettet with the value "null"), then the tooltip will not be displayed. (And I suggest that the getToolTipText () method should not be called)

This link may help you with this problem: How to use tooltips

(sorry for my english, I think this is not the best ,, ;-))

0
source

First you need to register with TooltipManager through

 TooltipManager.registerComponent() 

Even if this work continues, then

  • Check the value of TooltipManager.getInitialDelay ()
  • Check the value of TooltipManager.isEnabled ()
0
source

All Articles