Skip to content

Commit d85d930

Browse files
committed
clip/unclip problem in JViewport causing JTable paint issues
1 parent 67733aa commit d85d930

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

sources/net.sf.j2s.java.core/src/javax/swing/JViewport.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,19 +1626,21 @@ private void blitDoubleBuffered(JComponent view, Graphics g,
16261626
* @param g the <code>Graphics</code> context within which to paint
16271627
*/
16281628
private void paintView(Graphics g) {
1629-
Rectangle clip = g.getClipBounds();
16301629
JComponent view = (JComponent)getView();
16311630

16321631
if (view.getWidth() >= getWidth()) {
16331632
// Graphics is relative to JViewport, need to map to view's
16341633
// coordinates space.
16351634
int x = view.getX();
16361635
int y = view.getY();
1636+
Rectangle clip = g.getClipBounds();
16371637
g.translate(x, y);
1638-
g.setClip(clip.x - x, clip.y - y, clip.width, clip.height);
1639-
view.paintForceDoubleBuffered(g);
1638+
Graphics g1 = g.create();
1639+
g1.setClip(clip.x - x, clip.y - y, clip.width, clip.height);
1640+
view.paintForceDoubleBuffered(g1);
1641+
g1.dispose();
16401642
g.translate(-x, -y);
1641-
g.setClip(clip.x, clip.y, clip.width, clip.height);
1643+
//g.setClip(clip.x, clip.y, clip.width, clip.height);
16421644
}
16431645
else {
16441646
// To avoid any problems that may result from the viewport being

0 commit comments

Comments
 (0)