If you go to http://jtreemap.sourceforge.net/appletsample.html , the tooltips works fine in IE 6.0. If you hit CTRL-N to open a new window, the new window's tooltip will always be the same value regardless of which cell you mouse over. It happens sometimes after you hit F5 to refresh the page as well.
Logged In: NO
Fix:
Add the following line to the end of the constructor of DefaultToolTipBuilder
instance = null ;
Reason:
The reason this bug is there is because the "instance" field is static and initially assigned to null. The constructor does not set it to null.
When getToolTip is called, it checks "instance" for null and if it is (first time it is called), it sets it to
instance = new DefaultToolTip(this.jTreeMap, this.weightPrefix, this.valuePrefix, this.showWeight);
However, since the "instance" field is not assigned null in the constructor, subsequent calls don't change the tooltip. Hence, subsequent maps will not change the tooltip, until you exit out and restart the application, whereby again only the first treemap will have correct tooltips. Simple fix as mentioned above.
Logged In: YES
user_id=1613800
Originator: NO
The reason for this is 'private static JToolTip instance' in DefaultToolTipBuilder.
The tooltip returned for new JTreeMap references the old one, not only preventing it from being GCed, but also produces tooltip message taking the active area from the old JTreeMap.
Please remove the 'static' modifier.
This is because the DefaultToolTipBuilder class uses a static "instance" of the DefaultToolTip, which in turn uses a single JTreeMap instance. So the first JTreeMap to need a tooltip will always be the one supplying the tooltip data (due to the lazy implementation of IToolTipBuilder.getToolTip()).
If you want the DefaultToolTip, then subclass it to implement IToolTipBuilder interface and return itself (this) from the IToolTipBuilder.getToolTip() method. There's no reason it cannot be it's own tooltip builder.
I seem to like sginter 's idea of removing the 'static' modifier on DefaultToolTipBuilder.instance