< prev index next >

src/java.desktop/share/classes/javax/swing/table/DefaultTableModel.java

Print this page




 297      *                           all the rows were newly added
 298      * @see #getDataVector
 299      */
 300     public void newRowsAdded(TableModelEvent e) {
 301         justifyRows(e.getFirstRow(), e.getLastRow() + 1);
 302         fireTableChanged(e);
 303     }
 304 
 305     /**
 306      *  Equivalent to <code>fireTableChanged</code>.
 307      *
 308      *  @param event the change event
 309      *
 310      */
 311     public void rowsRemoved(TableModelEvent event) {
 312         fireTableChanged(event);
 313     }
 314 
 315     /**
 316      * Obsolete as of Java 2 platform v1.3.  Please use <code>setRowCount</code> instead.
 317      */
 318     /*
 319      *  Sets the number of rows in the model.  If the new size is greater
 320      *  than the current size, new rows are added to the end of the model
 321      *  If the new size is less than the current size, all
 322      *  rows at index <code>rowCount</code> and greater are discarded.
 323      *
 324      * @param   rowCount   the new number of rows
 325      * @see #setRowCount
 326      */
 327     public void setNumRows(int rowCount) {
 328         int old = getRowCount();
 329         if (old == rowCount) {
 330             return;
 331         }
 332         dataVector.setSize(rowCount);
 333         if (rowCount <= old) {
 334             fireTableRowsDeleted(rowCount, old-1);
 335         }
 336         else {
 337             justifyRows(old, rowCount);
 338             fireTableRowsInserted(old, rowCount-1);
 339         }
 340     }
 341 
 342     /**
 343      *  Sets the number of rows in the model.  If the new size is greater
 344      *  than the current size, new rows are added to the end of the model
 345      *  If the new size is less than the current size, all




 297      *                           all the rows were newly added
 298      * @see #getDataVector
 299      */
 300     public void newRowsAdded(TableModelEvent e) {
 301         justifyRows(e.getFirstRow(), e.getLastRow() + 1);
 302         fireTableChanged(e);
 303     }
 304 
 305     /**
 306      *  Equivalent to <code>fireTableChanged</code>.
 307      *
 308      *  @param event the change event
 309      *
 310      */
 311     public void rowsRemoved(TableModelEvent event) {
 312         fireTableChanged(event);
 313     }
 314 
 315     /**
 316      * Obsolete as of Java 2 platform v1.3.  Please use <code>setRowCount</code> instead.







 317      * @param   rowCount   the new number of rows

 318      */
 319     public void setNumRows(int rowCount) {
 320         int old = getRowCount();
 321         if (old == rowCount) {
 322             return;
 323         }
 324         dataVector.setSize(rowCount);
 325         if (rowCount <= old) {
 326             fireTableRowsDeleted(rowCount, old-1);
 327         }
 328         else {
 329             justifyRows(old, rowCount);
 330             fireTableRowsInserted(old, rowCount-1);
 331         }
 332     }
 333 
 334     /**
 335      *  Sets the number of rows in the model.  If the new size is greater
 336      *  than the current size, new rows are added to the end of the model
 337      *  If the new size is less than the current size, all


< prev index next >