int columns = table.getColumnCount(); for (int i = 0; i < columns; i++) { TableColumn col = table.getColumn(i); col.addListener(SWT.Resize, resizeListener); }
public TableCursor(Table parent, int style) {	super(parent, style);	table = parent;	setBackground(null);	setForeground(null);		Listener listener = new Listener() {		public void handleEvent(Event event) {			switch (event.type) {				case SWT.Dispose :					dispose(event);					break;				case SWT.KeyDown :					keyDown(event);					break;				case SWT.Paint :					paint(event);					break;				case SWT.Traverse :					traverse(event);					break;				case SWT.FocusIn :				case SWT.FocusOut :					redraw();					break;			}		}	};	addListener(SWT.Dispose, listener);	addListener(SWT.KeyDown, listener);	addListener(SWT.Paint, listener);	addListener(SWT.Traverse, listener);	addListener(SWT.FocusIn, listener);	addListener(SWT.FocusOut, listener);	tableListener = new Listener() {		public void handleEvent(Event event) {			switch (event.type) {				case SWT.MouseDown :					tableMouseDown(event);					break;				case SWT.FocusIn :					tableFocusIn(event);					break;			}		}	};	table.addListener(SWT.FocusIn, tableListener);	table.addListener(SWT.MouseDown, tableListener);	resizeListener = new Listener() {		public void handleEvent(Event event) {			resize();		}	};	int columns = table.getColumnCount();	for (int i = 0; i < columns; i++) {		TableColumn col = table.getColumn(i);		col.addListener(SWT.Resize, resizeListener);	}	ScrollBar hBar = table.getHorizontalBar();	if (hBar != null) {		hBar.addListener(SWT.Selection, resizeListener);	}	ScrollBar vBar = table.getVerticalBar();	if (vBar != null) {		vBar.addListener(SWT.Selection, resizeListener);	}}