Working with SWT Events
Take a look at the example in Figure 8.3, ButtonProject.java, which is designed to show how to handle events in SWT applications. When you click the button in this project, the application catches that event and then the message “Thanks for clicking.” appears in the Text widget.
Figure 8.3. Handling events in SWT applications.
This application starts by creating the Button widget it needs, giving it the caption “Click here,” and making it a push button (the allowed styles are SWT.ARROW, SWT.CHECK, SWT.PUSH, SWT.RADIO, SWT.TOGGLE, SWT.FLAT, SWT.UP, SWT.DOWN, SWT.LEFT, SWT.RIGHT, and SWT.CENTER):
import org.eclipse.swt.*; ...