Weird swing heavyweight & lightweight mixing problem
We have a problem in our swing based application since we've upgraded our java version from 6u5 to 6u18 (The application runs over WinXP).
Our application contains a Canvas object which resides in a JFrame. The application draws things on the canvas.
Every time we drag a lightweight swing object (popup or another frame) over the canvas, it has a refresh problem. It blinks - becomes black. The problem only resolves after we move the swing component away from the canvas and click on it again.
We think this problem is related to the fact the the canvas is a heavyweight object. And we know there were changes done in the new versions of java on the mixing of heavyweight and lightweight objects issue.
Some more details: 1) Our problem reproduces in java 6u14 and 6u16. 2) Everything works fine in java 6u5.
Another strange thing: We have 2 types of stations running our application. The first type has a ATI FireGL7100 PCI-E graphics card. The second type has a Matrox G450 PCI graphic card. The problem does not reproduce on the Matrox based station in any java version.
One more thing: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6829858 - looks similar to our problem.
Is our problem familiar? Do you have any suggestions (workarounds, ideas how the difference in graphics cards is connected to t开发者_Go百科his problem)
Hope I was clear enough, Yoav
The article Mixing heavy and light components describes how support for this changed in JDK 6 update 12. The two video cards may handle Z-order differently. Any chance your code has a workaround that's no longer needed?
We had problems w/ HW/LW mixing from 6u14+ (the fixes that breaks everything is in 14). Our problem was in a thirdy part library (JIDE) and they ended up fixing the problem on their end.
My suggestion is avoid HW where ever you can. You can get very decent performance out of LW if done correclty. What are you drawing that needs to be HW?
I don't know if this is relevant to anyone else, but we've found a workaround/fix for our problem.
We've set the system properties sun.awt.noerasebackground and sun.java2d.noddraw both to true. That eliminated our issue.
The only problem is that I'm not sure what other problems might rise from setting those system properties.
精彩评论