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.
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");
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.
Get SWT: A Developer's Notebook 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.