/[classpath]/classpath/javax/swing/JTable.java
ViewVC logotype

Diff of /classpath/javax/swing/JTable.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by mkoch, Sat Sep 25 17:42:16 2004 UTC revision 1.12 by mkoch, Mon Sep 27 13:29:37 2004 UTC
# Line 1148  public class JTable extends JComponent Line 1148  public class JTable extends JComponent
1148     */     */
1149    public void setModel(TableModel m)    public void setModel(TableModel m)
1150    {    {
1151        // Throw exception is m is null.
1152      if (m == null)      if (m == null)
1153        throw new IllegalArgumentException();        throw new IllegalArgumentException();
1154      TableModel tmp = dataModel;    
1155      if (autoCreateColumnsFromModel)      // Don't do anything if setting the current model again.
1156        createColumnsFromModel();      if (dataModel == m)
1157      if (tmp != null)        return;
1158        tmp.removeTableModelListener(this);      
1159        // Remove table as TableModelListener from old model.
1160        if (dataModel != null)
1161          dataModel.removeTableModelListener(this);
1162        
1163      if (m != null)      if (m != null)
1164        m.addTableModelListener(this);        {
1165      dataModel = m;          // Set property.
1166            dataModel = m;
1167    
1168            // Add table as TableModelListener to new model.
1169            dataModel.addTableModelListener(this);
1170    
1171            // Automatically create columns.
1172            if (autoCreateColumnsFromModel)
1173              createColumnsFromModel();
1174          }
1175        
1176        // Repaint table.
1177      revalidate();      revalidate();
1178      repaint();      repaint();
1179    }    }

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26