public Rectangle getCellRect ( int row , int column , boolean includeSpacing ) { Rectangle r = new Rectangle ( ) ; boolean valid = true ; if ( row < 0 ) { // y = height = 0; valid = false ; } else if ( row >= getRowCount ( ) ) { r . y = getHeight ( ) ; valid = false ; } else { r . height = getRowHeight ( row ) ; // r.y = (getRowModel() == null) ? row * r.height : // getRowModel().getPosition(row); r . y = row * r . height ; } if ( column < 0 ) { if ( ! getComponentOrientation ( ) . isLeftToRight ( ) ) { r . x = getWidth ( ) ; } // otherwise, x = width = 0; valid = false ; } else if ( column >= getColumnCount ( ) ) { if ( getComponentOrientation ( ) . isLeftToRight ( ) ) { r . x = getWidth ( ) ; } // otherwise, x = width = 0; valid = false ; } else { TableColumnModel64 cm = getColumnModel64 ( ) ; if ( getComponentOrientation ( ) . isLeftToRight ( ) ) { for ( int i = 0 ; i < column ; i ++ ) { r . x += cm . getColumnWidth ( i ) ; } } else { for ( int i = cm . getColumnCount ( ) - 1 ; i > column ; i -- ) { r . x += cm . getColumnWidth ( i ) ; } } r . width = cm . getColumnWidth ( column ) ; } if ( valid && ! includeSpacing ) { // Bound the margins by their associated dimensions to prevent // returning bounds with negative dimensions. int rm = Math . min ( getRowMargin ( ) , r . height ) ; int cm = Math . min ( getColumnModel ( ) . getColumnMargin ( ) , r . width ) ; // This is not the same as grow(), it rounds differently. r . setBounds ( r . x + cm / 2 , r . y + rm / 2 , r . width - cm , r . height - rm ) ; } return r ; }
must be override otherwise it will iterate over all columns