Buggy code:
public class Viewport < T > { private int firstRowIndex ; private int lastRowIndex ; private int firstColumnIndex ; private int lastColumnIndex ; private final Grid < T > grid ; private final GridModel < T > gridModel ; private final Rectangle viewportArea ; private final int RESIZE_DEADZONE = 3 ; public Viewport ( final Grid < T > grid ) { } public void invalidate ( ) { } public void calculateVisibleCellRange ( final GC gc ) { } public Rectangle getViewportArea ( final GC gc ) { } public int getVisibleRowWidth ( final GC gc ) { } public int getLastVisibleColumnIndex ( ) { } public int getLastVisibleRowIndex ( ) { } public int getFirstRowIndex ( ) { } public int getLastRowIndex ( ) { } public int getFirstColumnIndex ( ) { } public int getLastColumnIndex ( ) { } private void setFirstRowIndex ( final int firstRowIndex ) { } private void setLastRowIndex ( final int lastRowIndex ) { } private void setFirstColumnIndex ( final int firstColumnIndex ) { } private void setLastColumnIndex ( final int lastColumnIndex ) { } public int getColumnIndexByX ( final int x , final GC gc ) { } public int getColumnX ( final Column column ) { } public int getColumnViewportX ( final GC gc , final Column column ) { } public Column getColumnForMouseOperation ( final GC gc , final int x , final int y , final ColumnMouseOperation operation ) { } public int getRowIndexByY ( final int y , final GC gc ) { } public int getRowViewportY ( final GC gc , final Row < T > row ) { } public int getRowY ( final GC gc , final Row < T > row ) { } public void reveal ( final GC gc , final Column column , final Row < T > row ) { final int rowIndex = row . getRowIndex ( ) ; final int columnIndex = gridModel . getColumns ( ) . indexOf ( column ) ; final int vDelta = ( rowIndex < ( firstRowIndex ) ) ? - 1 : rowIndex > ( ( lastRowIndex ) - 1 ) ? 1 : 0 ; final int hDelta = ( columnIndex < ( firstColumnIndex ) ) ? - 1 : columnIndex > ( ( lastColumnIndex ) - 1 ) ? 1 : 0 ; if ( hDelta != 0 ) { if ( columnIndex == ( ( gridModel . getColumns ( ) . size ( ) ) - 1 ) ) { grid . getHorizontalBar ( ) . setSelection ( grid . getHorizontalBar ( ) . getMaximum ( ) ) ; } else { <START_BUG> final Column scrollToColumn = gridModel . getColumns ( ) . get ( ( columnIndex + 1 ) ) ; <END_BUG> if ( hDelta < 0 ) { grid . getHorizontalBar ( ) . setSelection ( ( ( getColumnX ( scrollToColumn ) ) - ( scrollToColumn . getWidth ( ) ) ) ) ; } else { grid . getHorizontalBar ( ) . setSelection ( ( ( getColumnX ( scrollToColumn ) ) - ( viewportArea . width ) ) ) ; } } } if ( vDelta != 0 ) { if ( rowIndex == ( ( gridModel . getRows ( ) . size ( ) ) - 1 ) ) { grid . getVerticalBar ( ) . setSelection ( grid . getVerticalBar ( ) . getMaximum ( ) ) ; } else { final Row < T > scrollToRow = gridModel . getRows ( ) . get ( Math . min ( ( rowIndex + 1 ) , ( ( gridModel . getRows ( ) . size ( ) ) - 1 ) ) ) ; if ( vDelta < 0 ) { grid . getVerticalBar ( ) . setSelection ( ( ( getRowY ( gc , scrollToRow ) ) - ( grid . getRowHeight ( scrollToRow ) ) ) ) ; } else { grid . getVerticalBar ( ) . setSelection ( ( ( getRowY ( gc , scrollToRow ) ) - ( viewportArea . height ) ) ) ; } } } } @ Override public String toString ( ) { } }

Fix:
final Column scrollToColumn = gridModel . getColumns ( ) . get ( columnIndex ) ;