O'Reilly logo

Java™ After Hours: 10 Projects You'll Never Do at Work by Steven Holzner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using SWT Toolbars

The Browser project uses an SWT ToolBar widget to display a set of buttons, as you see in Figure 8.1. To create a toolbar in the SWT, you just connect the toolbar with the shell you're working with and set its style.

For example, take a look at the SWT ToolbarProject application, which appears in Figure 8.4. There are four buttons in the toolbar, and when the user clicks one, that button is identified in a message that appears in the Text widget.

Figure 8.4. Using a toolbar in an SWT application.

The ToolbarProject.java application creates a new Toolbar object this way (the SWT.NONE style indicates that the toolbar won't have ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required