On the empty table, the attempt to select any rows or columns always throws IllegalArgumentException. Selecting nothing makes no sense and I think that the call should return without action.

2006-05-24  Audrius Meskauskas  <[EMAIL PROTECTED]>

   * javax/swing/JTable.java (selectAll): Return without action
   if the table is empty.

Index: JTable.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/JTable.java,v
retrieving revision 1.109
diff -u -r1.109 JTable.java
--- JTable.java	23 May 2006 18:10:32 -0000	1.109
+++ JTable.java	24 May 2006 05:55:13 -0000
@@ -3719,6 +3719,10 @@
    */
   public void selectAll()
   {
+    // The table is empty - nothing to do!
+    if (getRowCount() == 0 || getColumnCount() == 0)
+      return;
+    
     // rowLead and colLead store the current lead selection indices
     int rowLead = selectionModel.getLeadSelectionIndex();
     int colLead = getColumnModel().getSelectionModel().getLeadSelectionIndex();

Reply via email to