The wizard generates the following code including a main() method.
import
org.eclipse.swt.widgets.Display;
import
org.eclipse.swt.widgets.Shell;
public
class
SwtApplicationWindow {
protected Shell
shell;
public
static
void
main(String[] args) {
try {
SwtApplicationWindow window
= new
SwtApplicationWindow();
window.open();
}
catch
(Exception e) {
e.printStackTrace();
}
}
public
void
open() {
final Display display
= Display.getDefault();
createContents();
shell.open();
shell.layout();
while (!shell.isDisposed())
{
if (!display.readAndDispatch())
{
display.sleep();
}
}
}
protected
void
createContents() {
shell
= new
Shell();
shell.setSize(450,
300);
shell.setText("SWT
Application");
}
}
When editing SWT Application Windows, 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.
|