1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| //------------------------------------------------------------------------------
import org.eclipse.jface.layout.TableColumnLayout;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
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 TEST {
private static Display display;
private static Shell shell;
public static void main(final String[] args) {
display = new Display();
shell = new Shell(display, SWT.CLOSE | SWT.TITLE | SWT.MIN | SWT.RESIZE);
shell.setText("TEXT ..... BLABLA");
shell.setLayout(new GridLayout());
final Composite composite1 = new Composite(shell, SWT.FILL);
final TableColumnLayout iTableLayout = new TableColumnLayout();
composite1.setLayout(iTableLayout);
composite1.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false,
1, 1));
final Table Title = new Table(composite1, SWT.BORDER);
Title.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 0, 0));
Title.setHeaderVisible(false);
Title.setLinesVisible(false);
final TableColumn[] TitleCol = new TableColumn[2];
TitleCol[0] = new TableColumn(Title, SWT.LEFT);
iTableLayout.setColumnData(TitleCol[0], new ColumnWeightData(1));
TitleCol[1] = new TableColumn(Title, SWT.RIGHT);
iTableLayout.setColumnData(TitleCol[1], new ColumnWeightData(10));
final TableItem l0Title = new TableItem(Title, SWT.NONE);
l0Title.setText(0, "Blablabla1");
l0Title.setText(1, "Blablablabla2");
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
} |
Partager