public void tableChanged ( TableModelEvent e ) { if ( ( e . getFirstRow ( ) == TableModelEvent . HEADER_ROW ) || ( e . getLastRow ( ) >= m_vComponentCache . size ( ) ) ) { // Entire table changed, rebuild table this . removeAll ( ) ; this . setupPanel ( ) ; this . validate ( ) ; } else if ( e . getType ( ) == TableModelEvent . UPDATE ) { int iFirstRow = e . getFirstRow ( ) ; int iLastRow = e . getLastRow ( ) ; for ( int iRowIndex = iFirstRow ; iRowIndex <= iLastRow ; iRowIndex ++ ) { if ( iRowIndex < m_vComponentCache . size ( ) ) { ComponentCache componentCache = ( ComponentCache ) m_vComponentCache . elementAt ( iRowIndex ) ; if ( componentCache != null ) { // Move the data to the model for ( int iColumnIndex = 0 ; iColumnIndex < componentCache . m_rgcompoments . length ; iColumnIndex ++ ) { this . fieldToData ( componentCache , iRowIndex , iColumnIndex ) ; } } } else break ; } } }
The table has changed update the grid .