Creating an SWT Application

To create the Browser project, you're going to have to know how SWT applications work. Take a look at Figure 8.2, where you'll see just about the simplest such application. It just displays the text “An SWT label, very cool.” in an SWT Label widget inside an SWT window.

Figure 8.2. An SWT application.

This application, LabelProject.java, starts importing the SWT classes it needs and creating a new LabelProject object in the main method:

					import org.eclipse.swt.*;
					import org.eclipse.swt.widgets.*;
public class LabelProject
{
        public static void main(String [] args)
					{
					new LabelProject();
					}
        .
        .
        .
}

In the constructor, ...

Get Java™ After Hours: 10 Projects You'll Never Do at Work now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.