How to show horizontal scrollbar in table without using TableColumn.pack() [message #480933] |
Wed, 19 August 2009 01:41 |
Praveen K Subramanian Messages: 11 Registered: July 2009 |
Junior Member |
|
|
Hi all,
I have a table with two columns(as in the code below). The value in the
second column is long and adding column2.pack() makes the dialog look big.
But if I set column2.width(specific number) instead of column2.pack(),
then the horizontal scrollbar won't be visible for that column.
Is there a workaround?
Code snippet:
final Table table = new Table(shell, SWT.BORDER | SWT.RESIZE |
SWT.H_SCROLL | SWT.V_SCROLL);
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
final TableColumn column1 = new TableColumn(table, SWT.LEFT);
column1.setText("Column 1");
final TableColumn column2 = new TableColumn(table, SWT.LEFT);
column2.setText("Column 2");
table.setHeaderVisible(true);
table.setLinesVisible(true);
final TableItem item = new TableItem(table, SWT.NULL);
item.setText(0, "abcdefgh");
item.setText(1, "123456789012345678901234567890");
column1.pack();
column2.pack();
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03056 seconds