Buggy code:
public class Table extends Composite { TableItem [ ] items ; TableColumn [ ] columns ; TableColumn sortColumn ; TableItem currentItem ; NSTableHeaderView headerView ; NSTableColumn firstColumn ; NSTableColumn checkColumn ; NSBrowserCell dataCell ; int columnCount ; int itemCount ; int lastIndexOf ; int sortDirection ; boolean ignoreSelect ; boolean fixScrollWidth ; Rectangle imageBounds ; static final int FIRST_COLUMN_MINIMUM_WIDTH = 5 ; public Table ( Composite parent , int style ) { } int accessibilityAttributeValue ( int id , int sel , int arg0 ) { } void _addListener ( int eventType , Listener listener ) { } public void addSelectionListener ( SelectionListener listener ) { } TableItem _getItem ( int index ) { } int calculateWidth ( TableItem [ ] items , int index , GC gc ) { } boolean checkData ( TableItem item , boolean redraw ) { } static int checkStyle ( int style ) { } protected void checkSubclass ( ) { } public void clear ( int index ) { } public void clear ( int start , int end ) { } public void clear ( int [ ] indices ) { } public void clearAll ( ) { } void clearCachedWidth ( TableItem [ ] items ) { } public Point computeSize ( int wHint , int hHint , boolean changed ) { } void createColumn ( TableItem item , int index ) { } void createHandle ( ) { } void createItem ( TableColumn column , int index ) { } void createItem ( TableItem item , int index ) { } void createWidget ( ) { } Color defaultBackground ( ) { } NSFont defaultNSFont ( ) { } Color defaultForeground ( ) { } void deregister ( ) { } public void deselect ( int index ) { } public void deselect ( int start , int end ) { } public void deselect ( int [ ] indices ) { } public void deselectAll ( ) { } void destroyItem ( TableColumn column ) { } void destroyItem ( TableItem item ) { } boolean dragDetect ( int x , int y , boolean filter , boolean [ ] consume ) { } void drawInteriorWithFrame_inView ( int id , int sel , int cellFrame , int view ) { NSRect rect = new NSRect ( ) ; OS . memmove ( rect , cellFrame , sizeof ) ; boolean hooksErase = hooks ( EraseItem ) ; boolean hooksPaint = hooks ( PaintItem ) ; boolean hooksMeasure = hooks ( MeasureItem ) ; NSTableView tableView = ( ( NSTableView ) ( this . view ) ) ; NSBrowserCell cell = new NSBrowserCell ( id ) ; NSPoint pt = new NSPoint ( ) ; pt . x = ( rect . x ) + ( ( rect . width ) // 2 ) ; pt . y = ( rect . y ) + ( ( rect . height ) // 2 ) ; int rowIndex = ( ( int ) ( tableView . rowAtPoint ( pt ) ) ) ; TableItem item = _getItem ( rowIndex ) ; int nsColumnIndex = 0 ; int columnIndex = 0 ; if ( ( columnCount ) != 0 ) { nsColumnIndex = ( ( int ) ( tableView . columnAtPoint ( pt ) ) ) ; NSArray nsColumns = tableView . tableColumns ( ) ; id nsColumn = nsColumns . objectAtIndex ( nsColumnIndex ) ; for ( int i = 0 ; i < ( columnCount ) ; i ++ ) { if ( ( columns [ i ] . nsColumn . id ) == ( nsColumn . id ) ) { <START_BUG> columnIndex = indexOf ( columns [ i ] ) ; <END_BUG> break ; } } } Color background = ( ( item . cellBackground ) != null ) ? item . cellBackground [ columnIndex ] : null ; if ( background == null ) background = item . background ; boolean drawBackground = background != null ; boolean drawForeground = true ; boolean isSelected = tableView . isRowSelected ( rowIndex ) ; boolean drawSelection = isSelected ; Color selectionBackground = null ; Color selectionForeground = null ; if ( isSelected && ( hooksErase || hooksPaint ) ) { NSColor nsSelectionForeground ; NSColor nsSelectionBackground ; if ( isFocusControl ( ) ) { nsSelectionForeground = NSColor . alternateSelectedControlTextColor ( ) ; } else { nsSelectionForeground = NSColor . selectedControlTextColor ( ) ; } nsSelectionForeground = nsSelectionForeground . colorUsingColorSpace ( NSColorSpace . deviceRGBColorSpace ( ) ) ; nsSelectionBackground = cell . highlightColorInView ( tableView ) ; nsSelectionBackground = nsSelectionBackground . colorUsingColorSpace ( NSColorSpace . deviceRGBColorSpace ( ) ) ; float [ ] components = new float [ ( ( int ) ( nsSelectionForeground . numberOfComponents ( ) ) ) ] ; nsSelectionForeground . getComponents ( components ) ; selectionForeground = Color . cocoa_new ( display , components ) ; components = new float [ ( ( int ) ( nsSelectionBackground . numberOfComponents ( ) ) ) ] ; nsSelectionBackground . getComponents ( components ) ; selectionBackground = Color . cocoa_new ( display , components ) ; } NSSize contentSize = cell . cellSize ( ) ; NSSize spacing = tableView . intercellSpacing ( ) ; int contentWidth = ( ( int ) ( Math . ceil ( contentSize . width ) ) ) ; int itemHeight = ( ( int ) ( Math . ceil ( ( ( tableView . rowHeight ( ) ) + ( spacing . height ) ) ) ) ) ; NSRect cellRect = tableView . rectOfColumn ( nsColumnIndex ) ; cellRect . y = rect . y ; cellRect . height = ( rect . height ) + ( spacing . height ) ; if ( ( columnCount ) == 0 ) { NSRect rowRect = tableView . rectOfRow ( rowIndex ) ; cellRect . width = rowRect . width ; } if ( hooksMeasure ) { GCData data = new GCData ( ) ;

Fix:
columnIndex = i ;