Creating the Browser Project

As shown earlier in Figure 8.1, the Browser project uses ToolBar, Text, and Browser widgets. It starts by creating a good-sized shell to display the browser in:

import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;

public class BrowserProject
{
    Display display;
					Shell shell;

    public static void main(String[] args)
    {
        new BrowserProject();
    }

    BrowserProject()
    {
        display = new Display();
					shell = new Shell(display);
					shell.setText("The Browser Project");
					shell.setSize(600, 500);
        .
        .
        .
}

Then it creates the toolbar and buttons you see in Figure 8.1:

import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;

public class BrowserProject
{
    Display display;
    Shell shell;
    ToolBar toolbar;
					ToolItem go, forward, back, refresh, ...

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.