Hi,

I got a program here (the hsqldb DatabaseManagerSwing) that expects to
be able to fire null events to a TableModel when everything about the
model has changed. JTable wasn't handling that. Here is a proposed
patch:

2006-02-09  Mark Wielaard  <[EMAIL PROTECTED]>

    * javax/swing/JTable.java (tableChanged): Interpret null event as
    "everything changed".

OK?

Cheers,

Mark
Index: javax/swing/JTable.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JTable.java,v
retrieving revision 1.68
diff -u -r1.68 JTable.java
--- javax/swing/JTable.java	19 Jan 2006 22:22:04 -0000	1.68
+++ javax/swing/JTable.java	9 Feb 2006 16:23:33 -0000
@@ -1,5 +1,5 @@
 /* JTable.java -- 
-   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005, 2006  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -1878,22 +1878,22 @@
 
   /**
    * Invoked when the table changes.
+   * <code>null</code> means everything changed.
    */
   public void tableChanged (TableModelEvent event)
   {
     // update the column model from the table model if the structure has
     // changed and the flag autoCreateColumnsFromModel is set
-    if ((event.getFirstRow() ==TableModelEvent.HEADER_ROW)
-        && autoCreateColumnsFromModel)
-
+    if ((event == null || (event.getFirstRow() == TableModelEvent.HEADER_ROW))
+	&& autoCreateColumnsFromModel)
       createDefaultColumnsFromModel();
 
     // If the structure changes, we need to revalidate, since that might
     // affect the size parameters of the JTable. Otherwise we only need
     // to perform a repaint to update the view.
-    if (event.getType() == TableModelEvent.INSERT)
+    if (event == null || event.getType() == TableModelEvent.INSERT)
       revalidate();
-    else if (event.getType() == TableModelEvent.DELETE)
+    if (event == null || event.getType() == TableModelEvent.DELETE)
       {
         if (dataModel.getRowCount() == 0)
           clearSelection();

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to