From the author of

From the author of

Colored ToolTips

Have you ever wanted to change the foreground and/or background colors of your
ToolTips but didn't know how to accomplish this task? If so, keep reading.

To change the foreground and background colors for all ToolTips, override the
default values assigned to the ToolTip.foreground and ToolTip.background
color properties in UIManager's defaults table, as demonstrated by the
following code fragment:

The UIManager class keeps track of the current look and feel as well
as default values for look and feel–specific properties (such as colors,
fonts, and so on). UIManager uses a defaults table to maintain these
default values. After the preceding code fragment executes, the defaults table
contains Color.white as the default ToolTip foreground color value and
Color.blue as the default ToolTip background color value.

TIP

The java.awt.Color class declares several color constants in addition
to Color.white and Color.blue. Consult the SDK 1.3 documentation
on java.awt.Color for a complete list of these constants.

A GUI's appearance can be enhanced by changing the colors of its ToolTips.

The GUI in Figure 1 was generated by an application called ColoredTT.
Listing 1 presents the source code for this application. (Note: You can download
the files for the sample applications in this article by clicking
here.)