Question

We are building/maintaining a complex motion-control-platform control application with 14 subsystems, each with its own thread, including several animated 2D or 3D windows. Legacy requirements mandate JRuby 1.5.2 running on top of Java jre6 jdk1.6.0_21 with Java3D 1.5.2, on top of Windows (XP or 7).

When a Java Swing tooltip popup in one of the 2D control-panel windows, null Layout, overlaps & falls outside the bottom edge or sometimes the right edge of the window, the overall Windows Java screen update rate (for all the windows) slows from 16 Hz to 4 Hz. Often this effect continues until one of the windows is resized. Sometimes this effect goes away when the tooltip disappears. Occasionally the effect doesn't occur at all.

This occurs both on 32-bit Windows XP and 64-bit Windows 7, pointing more towards Java. There are other amusing bugs where the Windows sleep clock actually speeds up when random unrelated third-party communications applications are running, but I think that's a red herring--this one's definitely a Java + Windows windows-layout bug. Best guess is Windows can't handle Java's resizing the effective window area rapidly? But then why would the effect continue even after the tooltip popup goes away?

One source reports improvements with ensuring that all tooltips are "wider than 150 pixels". It is one workaround, although: since the mechanism for the bug is not known, and the bug is stochastic, this helpful voodoo does not seem to guarantee a solution; as well, it precludes short tooltips.

Does anyone know WHY this combination of JRuby/Java/Swing/Windows is having problems with tooltips, and what can be done about it seriously?

Was it helpful?

Solution

Attaching a profiler to the running application may offer some insight, but stochastic failure often implies incorrect synchronization. All Swing GUI objects must be constructed and manipulated only on the event dispatch thread. To find violations, use one of the approaches cited here. The ToolTipManager tries to use a lightweight component to display tooltips. If your application mixes light- and heavy-weight components, you can try disabling the feature:

ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top