tags:

views:

96

answers:

1

I am adding only three columns to the table but an extra column is also being displayed, I want exactly three columns. While resizing the window the column size is not increasing , what should i do. I am using GridLayout, should I use other layout.

Thanks in advance.

A: 

The last column is not a real column, but only exists to make up the difference between the table width and the sum of table columns width. Instead of displaying an empty area, the SWT Table widgets shows an "empty" synthetic column. Afaik the only way to make this table column go away is to automatically resize the real table columns to fit the whole width of the table control itself.

See java2s for an example how to resize table columns to fit the size of the table control automatically. Basically, it's adding a ControlListener to the table control which recalculates the column widths using the preferred column width and setting it manually.

mhaller
it was very very helpful, thanks a lot. Keep going.
yuvraj