ADDITIONAL SYSTEM INFORMATION :
Windows 7, 64 Bit, AdoptJDK12.0.1+12 64 Bit
A DESCRIPTION OF THE PROBLEM :
GIF images in HTML tooltips are not rendered under circumstances when referenced from resource.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Add a tooltip text with html tooltip containing an image ("<img src=..." from resource or http) to a Swing control (e.g. JButton).
Hovering over the button reveals tooltip with or without image under certain (unknown) circumstances.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The tooltips should show the images from the URL and the resource URL.
But it does not.
ACTUAL -
Only some images in the tooltip are rendered.
Tooltips do not render correct size.
---------- BEGIN SOURCE ----------
package components;
import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
public class TestImageToolTip {
public static void main(String[] args) {
JDialog dlg = new JDialog();
final JPanel p = new JPanel();
p.setLayout(new GridLayout(3, 1));
dlg.add(p);
final JButton labelVersion = new JButton(String.format("Java Version: %s - %s",
System.getProperty("java.vendor"), System.getProperty("java.version")));
p.add(labelVersion);
final JButton labelQuilt = new JButton("quilt tooltip here");
p.add(labelQuilt);
labelQuilt.setToolTipText(String.format("<html>%s<br>http: <img src=\"%s\"/><br>resource: <img src=\"%s\"/></html>",
"Quilt",
"https://upload.wikimedia.org/wikipedia/commons/b/bb/Quilt_design_as_46x46_uncompressed_GIF.gif",
TestImageToolTip.class.getResource("/Quilt_design_as_46x46_uncompressed_GIF.gif")));
final JButton label5Cell = new JButton("5-cell-tooltip here");
p.add(label5Cell);
label5Cell.setToolTipText(String.format("<html>%s: http: <img src=\"%s\"/> resource: <img src=\"%s\"/></html>",
"5-cell",
"https://upload.wikimedia.org/wikipedia/commons/thumb/d/d8/5-cell.gif/28px-5-cell.gif",
TestImageToolTip.class.getResource("/28px-5-cell.gif")));
dlg.getContentPane().add(p);
dlg.pack();
dlg.setModal(true);
dlg.setVisible(true);
dlg.dispose();
}
}
---------- END SOURCE ----------
FREQUENCY : always