Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Hello world!");
GridLayout gl=new GridLayout();
gl.numColumns=2;
shell.setLayout(gl);
Combo combo = new Combo(shell, SWT.READ_ONLY);
combo.setItems(new String[] { "A", "B", "C" });
combo.setSize(100, 200);
Label label =new Label(shell,SWT.CENTER);
label.setText("ahmed");
Label label2 =new Label(shell,SWT.CENTER);
label2.setText("kotb");
shell.pack();
shell.setLocation(display.getPrimaryMonitor().getBounds().width/2, display.getPrimaryMonitor().getBounds().height/2);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose(); |