The wizard generates the following code including a open() method.
import
org.eclipse.swt.SWT;
import
org.eclipse.swt.widgets.Dialog;
import
org.eclipse.swt.widgets.Display;
import
org.eclipse.swt.widgets.Shell;
public
class
SwtDialog extends
Dialog {
protected Object
result;
protected Shell
shell;
public SwtDialog(Shell parent,
int
style) {
super(parent, style)
}
public SwtDialog(Shell
parent) {
this(parent, SWT.NONE)
}
public Object open()
{
createContents();
shell.open();
shell.layout();
Display display =
getParent().getDisplay();
while (!shell.isDisposed())
{
if (!display.readAndDispatch())
{
display.sleep();
}
}
return
result;
}
protected
void
createContents() {
shell
= new
Shell(getParent(), SWT.DIALOG_TRIM
| SWT.APPLICATION_MODAL);
shell.setSize(450,
300);
shell.setText("SWT
Dialog");
}
}
When editing SWT Dialogs, all of the standard SWT layouts,
containers, widgets and menus are available. Custom or third party
controls may be added via the
Choose
Component command.
|