/[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.54 by rabbit78, Wed Oct 19 15:45:04 2005 UTC revision 1.55 by rabbit78, Fri Oct 28 13:52:29 2005 UTC
# Line 80  import javax.swing.table.TableColumnMode Line 80  import javax.swing.table.TableColumnMode
80  import javax.swing.table.TableModel;  import javax.swing.table.TableModel;
81  import javax.swing.text.Caret;  import javax.swing.text.Caret;
82    
83  public class JTable extends JComponent  public class JTable
84      extends JComponent
85    implements TableModelListener, Scrollable, TableColumnModelListener,    implements TableModelListener, Scrollable, TableColumnModelListener,
86               ListSelectionListener, CellEditorListener, Accessible               ListSelectionListener, CellEditorListener, Accessible
87  {  {
88    protected class AccessibleJTable extends AccessibleJComponent    /**
89       * Provides accessibility support for <code>JTable</code>.
90       *
91       * @author Roman Kennke (kennke@aicas.com)
92       */
93      protected class AccessibleJTable
94        extends AccessibleJComponent
95      implements AccessibleSelection, ListSelectionListener, TableModelListener,      implements AccessibleSelection, ListSelectionListener, TableModelListener,
96      TableColumnModelListener, CellEditorListener, PropertyChangeListener,      TableColumnModelListener, CellEditorListener, PropertyChangeListener,
97      AccessibleExtendedTable      AccessibleExtendedTable
# Line 149  public class JTable extends JComponent Line 156  public class JTable extends JComponent
156        getCellEditor().addCellEditorListener(this);        getCellEditor().addCellEditorListener(this);
157      }      }
158    
159        /**
160         * Returns the number of selected items in this table.
161         */
162      public int getAccessibleSelectionCount()      public int getAccessibleSelectionCount()
163      {      {
164        return getSelectedColumnCount();        return getSelectedColumnCount();
# Line 1034  public class JTable extends JComponent Line 1044  public class JTable extends JComponent
1044          setColumnModel(createDefaultColumnModel());          setColumnModel(createDefaultColumnModel());
1045          autoCreate = true;          autoCreate = true;
1046        }        }
     setModel(dm == null ? createDefaultDataModel() : dm);  
     setSelectionModel(sm == null ? createDefaultSelectionModel() : sm);  
     setAutoCreateColumnsFromModel(autoCreate);  
1047      initializeLocalVars();      initializeLocalVars();
     // The next two lines are for compliance with the JDK which starts  
     // the JLists associated with a JTable  with both lead selection  
     // indices at 0, rather than -1 as in regular JLists  
     selectionModel.setLeadSelectionIndex(0);  
     columnModel.getSelectionModel().setLeadSelectionIndex(0);  
1048      updateUI();      updateUI();
1049        setSelectionModel(sm == null ? createDefaultSelectionModel() : sm);
1050        setModel(dm == null ? createDefaultDataModel() : dm);
1051        setAutoCreateColumnsFromModel(autoCreate);
1052    }        }    
1053    
1054    protected void initializeLocalVars()    protected void initializeLocalVars()
# Line 1323  public class JTable extends JComponent Line 1328  public class JTable extends JComponent
1328        {        {
1329          int y0 = getLocation().y;          int y0 = getLocation().y;
1330          int nrows = getRowCount();          int nrows = getRowCount();
1331          Dimension gap = getIntercellSpacing();          int height = getRowHeight();
         int height = getRowHeight() + (gap == null ? 0 : gap.height);  
1332          int y = point.y;          int y = point.y;
1333    
1334          for (int i = 0; i < nrows; ++i)          for (int i = 0; i < nrows; ++i)
# Line 2033  public class JTable extends JComponent Line 2037  public class JTable extends JComponent
2037      // Don't do anything if setting the current model again.      // Don't do anything if setting the current model again.
2038      if (dataModel == m)      if (dataModel == m)
2039        return;        return;
2040        
2041        TableModel oldModel = dataModel;
2042    
2043      // Remove table as TableModelListener from old model.      // Remove table as TableModelListener from old model.
2044      if (dataModel != null)      if (dataModel != null)
2045        dataModel.removeTableModelListener(this);        dataModel.removeTableModelListener(this);
# Line 2050  public class JTable extends JComponent Line 2056  public class JTable extends JComponent
2056          if (autoCreateColumnsFromModel)          if (autoCreateColumnsFromModel)
2057            createDefaultColumnsFromModel();            createDefaultColumnsFromModel();
2058        }        }
2059        
2060        // This property is bound, so we fire a property change event.
2061        firePropertyChange("model", oldModel, dataModel);
2062    
2063      // Repaint table.      // Repaint table.
2064      revalidate();      revalidate();
2065      repaint();      repaint();

Legend:
Removed from v.1.54  
changed lines
  Added in v.1.55

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