This fixes painting of selected cells/rows.

2005-10-17  Roman Kennke  <[EMAIL PROTECTED]>

        * javax/swing/DefaultTableCellRenderer.java
        (getTableCellRendererComponent): Setup colors (more) correctly.
        * javax/swing/DefaultListSelectionModel.java
        (isSelectedIndex): Check for an illegal index argument.


/Roman
Index: javax/swing/table/DefaultTableCellRenderer.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/table/DefaultTableCellRenderer.java,v
retrieving revision 1.14
diff -u -r1.14 DefaultTableCellRenderer.java
--- javax/swing/table/DefaultTableCellRenderer.java	9 Aug 2005 15:56:40 -0000	1.14
+++ javax/swing/table/DefaultTableCellRenderer.java	17 Oct 2005 15:15:54 -0000
@@ -64,6 +64,7 @@
   {
     public UIResource()
     {
+      super();
     }
   }
 
@@ -135,7 +136,12 @@
     if (table == null)
       return this;
 
-    if (isSelected)
+    if (isSelected && hasFocus)
+      {
+        setBackground(table.getBackground());
+        setForeground(table.getSelectionForeground());
+      }
+    else if (table.isRowSelected(row))
       {
         setBackground(table.getSelectionBackground());
         setForeground(table.getSelectionForeground());
Index: javax/swing/DefaultListSelectionModel.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/DefaultListSelectionModel.java,v
retrieving revision 1.21
diff -u -r1.21 DefaultListSelectionModel.java
--- javax/swing/DefaultListSelectionModel.java	27 Jul 2005 12:41:33 -0000	1.21
+++ javax/swing/DefaultListSelectionModel.java	17 Oct 2005 15:15:54 -0000
@@ -388,6 +388,9 @@
    */
   public boolean isSelectedIndex(int a)
   {
+    // TODO: Probably throw an exception here?
+    if (a >= sel.length() || a < 0)
+      return false;
     return sel.get(a);
   }
 
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to