Determining when the tooltip is showing.

The ToolTipManager seems very thin to me. Is there any way of knowing when a ToolTip is showing on screen (so that I can suspend certain paints that could ruin the tooltiptext) ?

The only way I find as solution in case there are no methods for finding out when tooltip is showing is that I must have event handlers on every single component I have a tooltiptext on

say
MouseEntered
MouseExited

events on any of those components would set a boolean flag true/false for me to read within the game.

A hacky way would be to check the JApplet/JFrame’s RootPaneContainer’s glassPane which is the component that is the parent of all tooltips.

Check this method out:

http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/RootPaneContainer.html#getGlassPane()

& with the glassPane do
glassPane.getCOmponents() & hopefully you’ll have all of your visible tooltips!

Keith

EDIT: and I nearly forgot, you’d best do that on the event dispatch thread using SwingWorker.invokeLater() or invokeNow().

I found a simplke woraround. The problem I got was a tooltip showing as a white rectangle with no text. The reasons was that I was constantly updating my drawing surface so by reducing frame rates I got the tooltip working. The odd thing though, was that the area where I had tooltip was not the same area as where i was repainting due to frame rate and I was actually using passive rendering!

Was not passive rendering supposed to not interfer with other drawing code?