Use images in tooltips
import javax.swing.JFrame;
import javax.swing.JLabel;
public class Main {
public static void main(String[] args) {
JFrame frame = new JFrame();
JLabel label = new JLabel("Label with image in Tooltip!");
label.setToolTipText("<html><img src=\"" + Main.class.getResource("tooltip.gif")
+ "\"> Tooltip ");
label.setHorizontalAlignment(JLabel.CENTER);
frame.setContentPane(label);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setBounds(100, 100, 200, 100);
frame.setVisible(true);
}
}
Related examples in the same category