Download the sample archive from the eclipse download site (e.g. org.eclipse.sdk.examples-3.7.zip ).
Locate the plugins\org.eclipse.swt.examples.source_3.7.0.v3735b.jar file in the archive (or another suitable jar file) in the archive and extract the contents (the jar are simply renamed to zip files) into some existing Eclipse project or create new (e.g. SWTExamples). In the src folder you can find all the sources of examples. To run the test case, run the project with the main class org.eclipse.swt.examples.controlexample.ControlExample .
In the org.eclipse.swt.examples.controlexample package you can find the sources you are looking for.
IMHO control examples have quite complicated source code, but you can find what you need.
source share