Finally we code !
In this section we will see how to create your Wazaabi Application with a set of code snippet. Notice that all examples in this page are available on the SVN repository in the org.wazaabi.engine.swt.snippets project.
Snippet 1: one Big true Button
In this snippet we open a shell with the Wazaabi viewer and we create a big button.
public static void main(String[] args) {
// init SWT Engine in standalone mode
SWTStandaloneHelper.init();
// create the shell
Display display = new Display();
Shell mainShell = new Shell(display, SWT.SHELL_TRIM);
mainShell.setLayout(new FillLayout());
mainShell.setSize(300, 300);
// create the viewer
SWTControlViewer viewer = new SWTControlViewer(mainShell);
// create a button
PushButton pushButton = WidgetsFactory.eINSTANCE.createPushButton();
pushButton.setText("Hello World"); //$NON-NLS-1$
// Set the content
viewer.setContents(pushButton);
mainShell.open();
while (!mainShell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
Notice that here, the viewer takes as content the push button, that's why all the space is taken by the button.
