This section illustrates how to show an image in tool tip. One example is given below for illustration.
This program shows a command button. When you move the mouse pointer around the button then a tool tip text will be seen with an image. Through the help of this example you can easily attach an image with the tool tip text.
Screen shot for the result of the given program:
In this program, some html tags are using for showing the tool tip text with an image. These html tags are understood by using HTML class from the javax.swing.text.html.*; package of Java Swing. Here tooltiptext is the string variable which contains several text. Html tags are also included. This code uses the <img> tag of html which calls the image which has to be shown with the tool tip text.
Here is the code of the program:
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial