During JTable editing session, the whole JTable was repainted each time
the cursor blinks and each time the key is pressed. This makes editing
of the really large tables difficult (slow response). Also, the whole
table was repainted after temporary placing another window only over the
part of the table. I found that the repaint scope is extended from the
single cell to the whole table in JViewport.paintBackingStore. If the
viewport has not been scrolled, the computeBlit returns the documented
false and then the whole buffer is refreshed in response instead of just
repainting the requested area that can be very small.
The problem can be solved by transferring the clip rect info from the
passed graphics g to the buffer graphics g2. I did not notice any
regressions after this change.
2006-02-18 Audrius Meskauskas <[EMAIL PROTECTED]>
* javax/swing/JViewport.java (paintBackingStore): If the component has
not been scrolled, only repaint the buffer part, indicated by
the parameter graphics clip.
Index: JViewport.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/JViewport.java,v
retrieving revision 1.43
diff -u -r1.43 JViewport.java
--- JViewport.java 16 Feb 2006 13:32:50 -0000 1.43
+++ JViewport.java 18 Feb 2006 21:50:26 -0000
@@ -871,6 +871,11 @@
// everything.
else
{
+ // If the image has not been scrolled at all, only the changed
+ // clip must be updated in the buffer.
+ if (dx==0 && dy==0)
+ g2.setClip(g.getClip());
+
paintSimple(g2);
}
g2.dispose();