We were painting the vertical and horizontal grid lines in JTable one
pixel too far left/below on the first pixel row of the adjecent table
cell, whereas they should really be painted on the last pixel row of the
current cell. This patch fixes this. This makes the cells nicely aligned
with the table header cells finally.

2006-02-15  Roman Kennke  <[EMAIL PROTECTED]>

        * javax/swing/plaf/basic/BasicTableUI.java
        (paint): Paint vertical and horizontal lines one pixel shifted
        left/top.

/Roman
Index: javax/swing/plaf/basic/BasicTableUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTableUI.java,v
retrieving revision 1.42
diff -u -r1.42 BasicTableUI.java
--- javax/swing/plaf/basic/BasicTableUI.java	14 Feb 2006 22:03:06 -0000	1.42
+++ javax/swing/plaf/basic/BasicTableUI.java	15 Feb 2006 10:23:03 -0000
@@ -1263,8 +1263,8 @@
         for (int c = c0; c < cn; ++c)
           {
             bounds = table.getCellRect(0, c, true);
-            gfx.drawLine(bounds.x + bounds.width, p1.y,
-                         bounds.x + bounds.width, p2.y);
+            gfx.drawLine(bounds.x + bounds.width - 1, p1.y,
+                         bounds.x + bounds.width - 1, p2.y);
           }
         gfx.setColor(save);
       }
@@ -1277,8 +1277,8 @@
         for (int r = r0; r < rn; ++r)
           {
             bounds = table.getCellRect(r, 0, true);
-            gfx.drawLine(p1.x, bounds.y + bounds.height,
-                         p2.x, bounds.y + bounds.height);
+            gfx.drawLine(p1.x, bounds.y + bounds.height - 1,
+                         p2.x, bounds.y + bounds.height - 1);
           }
         gfx.setColor(save);
       }

Reply via email to