In my application, there is a screen where you open an image into a scroll pane on the left of the screen and the image is compressed and displayed in a scrollpane on the right hand side of the screen. The scroll panes are also in sync with each other. That means that you scroll the left one and the right one will also scroll to keep them in tune.
In 1.4.2 the user can open the image, compress it and scroll around it fine.
In 1.5 however, the user can open the image, compress it, but as soon as they try to scroll in the compressed image pane, the image becomes garbled.
I am using a custom component inside the scroll pane, so I'll post that code here as it is the only conceivable place that could be doing this.
I would be very greatful if anyone can give me a hand in sorting this out so that this error on 1.5 doesn't occur.
Looked around in the bug database but couldn't find anything more relevant than this: Wide BufferedImage displays corrupted image The obvious thing to check for the 'garbage' symptom is that your component is properly repainting the image during scrolling. I ran your code as–is and could not get the garbage effect (win xp, j2se 1.5.0). Scaling BufferedImages with AffineTransform can bring trouble in j2se 1.5 caused by system changes made to enhance hardware acceleration. Sun engineers say this has been fixed in j2se 1.6, Mustang. So I would experiment. Try making a new BufferedImage for each rescale and see if you get the same result. Or try loading (asynchronous) a scaled image with 'image.getScaledInstance(w, h, Image.SCALE_AREA_AVERAGING)' for each rescale. Also, some of the bug reports suggest that some video cards may be causing similar problems along these lines.
Joined: May 18, 2004
Thank you so much for trying out my code. It makes a lot of sense that it could be hardware related as that is the only linking factor between the computers that show the error and those that don't.
But I'll give your example as much of a go as I can today (big launch day!) and I'll let you know how it goes.
And I'm also going to try the -D option that was in that bug report.
Thanks again! Rachel
Joined: May 18, 2004
That -D string solves the problem on two out of the three computers here experiencing the problem. So at least that's something!
I also think that to solve this, I need to understand what the JScrollPane is doing as I drag the scroll bar, so I'll google on that next.
subject: JScrollPane displays image in 1.4.2 but not in 1.5