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 59 60
|
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Text;
public class essailayout {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display, SWT.RESIZE | SWT.CLOSE | SWT.MIN);
shell.setText("Youhouuuu!!");
RowLayout layout = new RowLayout();
layout.wrap = true;
shell.setLayout(layout);
Label l1 = new Label(shell, SWT.LEFT);
l1.setText("Tu t'appelles comment?");
Text txt1 = new Text(shell, SWT.BORDER);
txt1.setText("Coucou");
Button b1 = new Button(shell, SWT.PUSH);
b1.setText("Essai pour voir");
b1.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent event)
{
MessageBox box = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
box.setText("Validation");
box.setMessage("Vous vous appelez " + txt1.getText());
box.open();
}
});
shell.pack();
shell.open();
while (!shell.isDisposed())
{
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
} |