Friday, May 6, 2011

Problem with Painting in Java Swing App in Java 1.6

Hi,

I'm working on a Swing application (currently running on Java 1.6 update 11) which has some intermittent paint refresh problems (e.g. there are artifacts etc.). This only happens to some users of our application but not others.

After doing some research, I found that setting the property sun.java2d.d3d to false may help and in fact, it helped for one of our users.

Now that some other users are complaining about the issue, I'm thinking of setting the property to false for all users.

My basic questions are the following:

What exactly is the cause of this? Is it the video card? Is it the driver? Is it a bug from Sun? (such as http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6635462) Combination of all three?

In other words, is is best to simply turn this property off or is it affecting only certain video cards in which an update to the latest driver would fix?

From stackoverflow
  • Java introduced in R6 update 10 a pipeline that renders graphics based on Direct3D. According to the release description here it supports only NVidia and ATI cards, which means anyone not using those cards may have a problem. Since it is a recent innovation I would suggest that anyone using old drivers for those cards may also have problems. Upgrading a video driver will probably fix the first case but not the last.

    If you set sun.java2d.d3d to false the worst that can happen is that some users will not achieve the performance that they theoretically could. You will have to balance whether this is preferable to the issues that you are seeing at the moment.

    Avrom : The user who first had the issue had an ATI Radeon XPress 200 but I did not check whether they had the latest driver. The application is a pretty "standard" Swing app, i.e. no 3D operations or "out of the ordinary" paint operations.
    Avrom : One would think that it would auto turn off for unsupported video cards, assuming that were possible.
  • Are all painting and model changing operations execute on EDT (e.g. changing TableModel etc.)?

0 comments:

Post a Comment