import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
public class TableTest {
private static int NUMCOLS = 40;
private static int NUMROWS = 100;
/**
* @param args
*/
public static void main(String[] args) {
Display display = new Display ();
Shell shell = new Shell (display);
shell.setLayout(new GridLayout(1, false));
Table mainTable = new Table(shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL );
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
mainTable.setLayoutData(gd);
mainTable.setHeaderVisible(false);
mainTable.setLinesVisible(true);
for (int i = 0; i < NUMCOLS; i ++){
TableColumn column = new TableColumn(mainTable, SWT.NONE);
column.setWidth(60);
column.setText("COLUMN " + (i+1));
}
for (int i = 0; i < NUMROWS; i++){
TableItem item = new TableItem(mainTable, SWT.NONE);
for (int j = 0; j < NUMCOLS; j++){
item.setText(j, i + "_" + j);
}
}
shell.pack ();
shell.setSize(400,400);
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
}
]]>