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 54 55 56 57 58
|
public Snippet(Shell parent)
{
super(parent);
}
public static void main(String[] arv)
{
Display display = new Display();
Shell dialogShell = new Shell(display, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE);
dialogShell.setLayout(new GridLayout(1, true));
final SashForm tables = new SashForm(dialogShell, SWT.HORIZONTAL | SWT.SMOOTH);
tables.SASH_WIDTH = 5;
tables.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
tables.setLayout(new FillLayout(SWT.HORIZONTAL));
Table left = new Table(tables, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER);
left.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
left.setLinesVisible(true);
left.setHeaderVisible(true);
middleSide(tables);
Table right = new Table(tables, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER);
right.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
right.setLinesVisible(true);
right.setHeaderVisible(true);
tables.setWeights(new int[] { 48, 4, 48 });
dialogShell.setSize(850, 400);
dialogShell.open();
while (!dialogShell.isDisposed())
{
if (!display.readAndDispatch())
{
display.sleep();
}
}
}
private static void middleSide(Composite parent)
{
Composite composite = new Composite(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout(1, false);
gridLayout.verticalSpacing = 25;
composite.setLayout(gridLayout);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
Button add = new Button(composite, SWT.PUSH);
add.setText(">");
add.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
Button remove = new Button(composite, SWT.PUSH);
remove.setText("<");
remove.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true));
} |
Partager