The wizard generates the following code including a main() method.
import
org.eclipse.swt.SWT;
import
org.eclipse.swt.widgets.Display;
import
org.eclipse.swt.widgets.Shell;
public
class
SwtShell extends
Shell {
public
static
void
main(String[] args) {
try
{
Display display = Display.getDefault();
SwtShell shell =
new
SwtShell(display,
SWT.SHELL_TRIM);
shell.open();
shell.layout();
while
(!shell.isDisposed()) {
if
(!display.readAndDispatch()) {
display.sleep();
}
}
}
catch
(Exception e) {
e.printStackTrace();
}
}
public
SwtShell(Display display,
int
style) {
super(display,
style);
createContents();
}
protected
void
createContents() {
setText("SWT
Application");
setSize(450, 300);
}
protected void checkSubclass() {
// Disable the
check that prevents subclassing of SWT components
}
}
When editing SWT Shells, 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.
|