03 August 2002 - java_dev (original) (raw)
I'm writing a spectrum analysis application where a BufferedImage gets continuously updated and is displayed in a JPanel, which, in turn, is displayed in a JScrollPane.
I call the JPanel.repaint(x,y,width,height) method for repainting the small updated part of the picture. When I move the JPanel picture in the JScrollPane using scrollbars, occasionally parts of it don't get repainted properly.
Is there a way to set some property or policy that would make the repainting more accurate?
If not, I need either to repaint the whole thing after each time sliders had been used, or, preferably, repaint just the area that had been updated while sliders were being used
I guess I could somehow intercept AdjustmentEvents from JScrollBars, but how do I find out when the adjustment had actually taken place in the JScrollPane?
Any comments/suggestions will be appreciated.