• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 4. SWT Toolbars

Chapter 4. SWT Toolbars

To complete the examination of building windows using the SWT you must look at the final element that end users expect to see in a well-designed window—the toolbar. A toolbar is a row of buttons that appears below the menu and above the working area of the window to allow one-click access to the most commonly used functionality of your application. If your application supports the use of a menu—and almost every application will—it can benefit from the use of a toolbar.

Toolbar buttons can have a text label, an image, or both; the use of images that provide a hint about the functionality of the button is a nice touch. If you examine other applications running on your chosen platform, you will likely find that the use of images, rather than text, is the norm. Toolbar buttons also often make use of pop-up Help text that appears whenever the mouse hovers over the button.

SWT provides two classes that you use in toolbar creation—the ToolBar and ToolItem classes. These classes are part of the org.eclipse.swt.widgets package. The Image class, located in the org.eclipse.swt.graphics package, is also used to load and specify an icon or bitmap for use as a toolbar button's image, just as it specified a window icon for your shell back in Chapter 2.

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint