The previous patch includes unplanned change (adding debug code) to the BasicTableUI. The corrected patch is attached. The change was not comitted to CVS repository, only posted to the list. Sorry.

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

   * javax/swing/JTable.java (columnSelectionChanged):
   Removed print statement.
   * javax/swing/DefaultListSelectionModel.java
   (addSelectionInterval, removeSelectionInterval):
   Fire the difference between selection. (setLeadSelectionIndex):
   Fire the difference and mark current and previous lead
   selection indexes for repaint.


Index: DefaultListSelectionModel.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/DefaultListSelectionModel.java,v
retrieving revision 1.27
diff -u -r1.27 DefaultListSelectionModel.java
--- DefaultListSelectionModel.java	31 Mar 2006 10:13:15 -0000	1.27
+++ DefaultListSelectionModel.java	31 Mar 2006 21:39:21 -0000
@@ -286,8 +286,14 @@
     int beg = sel.nextSetBit(0), end = -1;
     for(int i=beg; i >= 0; i=sel.nextSetBit(i+1)) 
       end = i;
-    if (sel.equals(oldSel) == false)
-      fireValueChanged(beg, end, valueIsAdjusting);    
+    
+    BitSet old = (BitSet) oldSel;
+    
+    // The new and previous lead location requires repainting.
+    old.set(oldLeadIndex, !sel.get(oldLeadIndex));
+    old.set(leadSelectionIndex, !sel.get(leadSelectionIndex));
+    
+    fireDifference(sel, old);
   }
 
   /**
@@ -492,8 +498,7 @@
         leadSelectionIndex = index1;
         anchorSelectionIndex = index0;
         sel.set(lo, hi+1);
-        if (sel.equals(oldSel) == false)
-          fireValueChanged(lo, hi, valueIsAdjusting);
+        fireDifference(sel, (BitSet) oldSel);
       }
   }
 
@@ -530,8 +535,8 @@
     //TODO: will probably need MouseDragged to test properly and know if this works
     setAnchorSelectionIndex(index0);
     leadSelectionIndex = index1;
-    if (sel.equals(oldSel) == false)
-      fireValueChanged(lo, hi, valueIsAdjusting);
+    
+    fireDifference(sel, (BitSet) oldSel);
   }
 
   /**
Index: JTable.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/JTable.java,v
retrieving revision 1.93
diff -u -r1.93 JTable.java
--- JTable.java	31 Mar 2006 21:10:08 -0000	1.93
+++ JTable.java	31 Mar 2006 21:39:29 -0000
@@ -1886,7 +1886,6 @@
     
     int idx0 = event.getFirstIndex();
     int idxn = event.getLastIndex();
-    System.out.println("IDX "+idx0+"-"+idxn);
     int i;
 
     for (i = 0; i < idx0; i++)

Reply via email to