Currently the cell editor starts few pixels right from where the cell content was previously painted. This is because the moveToCellBeingEdited contains the hard coded offset, probably a compensation of some bug that is now fixed. The cell content is now painted much closer to the left cell boundary. I remove this compensating code to start editor exactly in the place of the previous content. Also, Sun shows the text editing field with the border, probably we also should.

2006-03-18  Audrius Meskauskas  <[EMAIL PROTECTED]>

   * javax.swing.JTable.java (TableTextField): Set border.
   (moveToCellBeingEdited): Do not adjust the editor boundaries
Index: JTable.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/JTable.java,v
retrieving revision 1.83
diff -u -r1.83 JTable.java
--- JTable.java	13 Mar 2006 21:33:37 -0000	1.83
+++ JTable.java	18 Mar 2006 11:20:40 -0000
@@ -1253,7 +1253,7 @@
        */
       TableTextField()
       {
-        setBorder(null);
+        setBorder(BorderFactory.createLineBorder(getGridColor(), 2));
       }
     
       /**
@@ -3658,16 +3658,6 @@
   private void moveToCellBeingEdited(Component component)
   {
      Rectangle r = getCellRect(editingRow, editingColumn, true);
-     // Place the text field so that it would not touch the table
-     // border.
-     
-     // TODO Figure out while 5 and which constant should here be.
-     int xOffset = 5;
-     r.x+=xOffset;
-     r.y++;
-     r.width -=xOffset;
-     r.height --;
-     
      // Clone rectangle as getCellRect returns the cached value.
      component.setBounds(new Rectangle(r));
   }

Reply via email to