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

Chapter 4. SWT Toolbars > Using Tool Tips

4.8. Using Tool Tips

Tool tip text provides a hint to the user about the function triggered by clicking a toolbar button. The tip appears in a pop-up text field at the mouse cursor location whenever the user pauses the mouse over a button. This is a feature that users expect to see in any toolbar.

4.8.1. How do I do that?

SWT makes it very easy to create tool tips. All you must do is assign the desired text to a ToolItem by calling the setToolTipText( ) method, and pass the method the String value you wish to appear as the tool tip. Adding this line to your ToolbarShellExample results in Figure 4-6 when the mouse cursor is moved over the Open button:

openItem.setToolTipText("Open File");

Figure 4-6. Toolbar button with tool-tip text


The SWT provides you with everything you need to create sophisticated toolbars, something your users will expect in almost every application you deliver. As you have seen in the last three chapters, the SWT makes it easy to build the windows that serve as the foundation of your applications.

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