import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; ... ... Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new RowLayout()); final Label label = new Label(shell, SWT.NONE); label.setText("Hello, World!"); Button button = new Button(shell, SWT.PUSH); button.setText("Create lines"); button.addSelectionListener(new SelectionListener() { @Override public void widgetDefaultSelected(SelectionEvent arg0) { createLines(); } @Override public void widgetSelected(SelectionEvent event) { createLines(); } }); shell.pack(); label.pack(); button.pack(); shell.open(); while (!shell.isDisposed()) if (!display.readAndDispatch()) display.sleep(); display.dispose(); label.dispose(); button.dispose();
this.setShellStyle( SWT.ON_TOP);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)