Username:
Password:
Java 6 Tutorials

User Interface / Tool Tips

Subtitles of the Movie

Tool tips, those little text pop-ups that appear when you hold the mouse pointer over a component. They usually contain text that answers the question what's this? You can add a tool tip to every component displayed by your application. This is almost the same program as the one from the previous lesson on toolbars. This time a tool tip has been added to each toolbar button and to the text area in the center. With any class that has a JComponent as a super class, you can use the same method call to insert text for a tool tip. A tool tip has been added to the text area in the center of the window with this call to set tool tip text. A new and third parameter has been added to the make tool button method. It is this string that is to be the text of the tool tip for the buttons. One line has been added to the method that makes toolbar buttons. The call to set tool tip text using the string from the new parameter adds the text to each button the method constructs. Nothing else has changed from the previous version. Here's how it works. If you let the mouse pointer rest on one of the toolbar buttons, a tool tip appears. Once the first tool tip has appeared, you don't have to wait for the others. They sort of pop up automatically. The tool tips continue to work, regardless of the position of the tool bar. Waiting for a bit or moving the mouse out of the toolbar causes the tool tip to vanish. If you remember, this example also defined a tool tip for the text area in the center. Ok. That's all we'll be doing with the user interface for a while. Later in the course we will be looking into splash screens and making sounds, but in the next few lessons coming up, we're going to talk about generics; one of the strange departures made by the newer versions of Java.

Tutorial Information

Course: Java 6
Author: Arthur Griffith
SKU: 33858
ISBN: 1-934743-59-3
Release Date: 2008-02-29
Duration: 7 hrs / 92 lessons
Work Files: Yes
Captions: Available on CD and Online University
Compatibility: Vista/XP/2000, OS X, Linux
QuickTime 7, Flash 8

VTC Sign up & Benefits

  • Unlimited Access
  • 81,350 Video Tutorials (20,800 free)
  • Video Available as Flash or QuickTime
  • Over 782 Courses
  • $30 for One Month Access
  • Multi-User Discounts Available