TableColumn column = columns [columns.length - 1];
TableColumn[] orderedColums = getOrderedColumns (); TableColumn column = orderedColums [orderedColums.length - 1];
void onPaint (Event event) {	TableColumn[] orderedColumns = getOrderedColumns ();	GC gc = event.gc;	Rectangle clipping = gc.getClipping ();	int headerHeight = getHeaderHeight ();	int numColumns = orderedColumns.length;	int startColumn = -1, endColumn = -1;	if (numColumns > 0) {		startColumn = computeColumnIntersect (clipping.x, 0);		if (startColumn != -1) {	/* the clip x is within a column's bounds */			endColumn = computeColumnIntersect (clipping.x + clipping.width, startColumn);			if (endColumn == -1) endColumn = numColumns - 1;		}	} else {		startColumn = endColumn = 0;	}	/* Determine the TableItems to be painted */	int startIndex = (clipping.y - headerHeight) / itemHeight + topIndex;	int endIndex = -1;	if (startIndex < itemsCount) {		endIndex = startIndex + Compatibility.ceil (clipping.height, itemHeight);	}	startIndex = Math.max (0, startIndex);	endIndex = Math.min (endIndex, itemsCount - 1);	int current = 0;	for (int i = startIndex; i <= endIndex; i++) {		TableItem item = items [i];		if (startColumn == -1) {			/* indicates that region to paint is to the right of the last column */			item.paint (gc, null, false);		} else {			if (numColumns == 0) {				item.paint (gc, null, true);			} else {				for (int j = startColumn; j <= endColumn; j++) {					item.paint (gc, orderedColumns [j], true);				}			}		}		if (isFocusControl ()) {			if (focusItem == item) {				Rectangle focusBounds = item.getFocusBounds ();				if (focusBounds.width > 0) {					gc.setClipping (focusBounds);					int[] oldLineDash = gc.getLineDash ();					if (item.isSelected ()) {						gc.setLineDash (new int[] {2, 2});					} else {						gc.setLineDash (new int[] {1, 1});					}					gc.drawFocus (focusBounds.x, focusBounds.y, focusBounds.width, focusBounds.height);					gc.setLineDash (oldLineDash);				}			}		}	}	/* fill background not handled by items */	gc.setBackground (getBackground ());	gc.setClipping (clipping);	Rectangle clientArea = getClientArea ();	int bottomY = endIndex >= 0 ? getItemY (items [endIndex]) + itemHeight : 0;	int fillHeight = Math.max (0, clientArea.height - bottomY);	if (fillHeight > 0) {	/* space below bottom item */		gc.fillRectangle (0, bottomY, clientArea.width, fillHeight);	}	if (columns.length > 0) {		TableColumn column = columns [columns.length - 1];	/* last column */		int rightX = column.getX () + column.width;		if (rightX < clientArea.width) {			gc.fillRectangle (rightX, 0, clientArea.width - rightX, clientArea.height - fillHeight);		}	}	/* repaint grid lines */	if (linesVisible) {		gc.setForeground (display.getSystemColor (SWT.COLOR_WIDGET_LIGHT_SHADOW));		if (numColumns > 0 && startColumn != -1) {			/* vertical column lines */			for (int i = startColumn; i <= endColumn; i++) {				int x = columns [i].getX () + columns [i].width - 1;				gc.drawLine (x, clipping.y, x, clipping.y + clipping.height);			}		}		/* horizontal item lines */		bottomY = clipping.y + clipping.height;		int rightX = clipping.x + clipping.width;		int y = (clipping.y - headerHeight) / itemHeight * itemHeight + headerHeight;		while (y <= bottomY) {			gc.drawLine (clipping.x, y, rightX, y);			y += itemHeight;		}	}}