ADDITIONAL SYSTEM INFORMATION :
java.runtime.name=Java(TM) SE Runtime Environment
java.vm.version=25.212-b10
java.vm.name=Java HotSpot(TM) 64-Bit Server VM
java.runtime.version=1.8.0_212-b10
os.arch=amd64
os.name=Windows 10
os.version=10.0
java.specification.version=1.8
A DESCRIPTION OF THE PROBLEM :
After release Java8u202 (including 211 and 212), <img/> tags without dimensions set as HTML tool tip of a Swing component are no longer rendered and the image can not be seen.
Dimensionless images are correctly rendered in HTML tooltips in Java8u201 and below.
REGRESSION : Last worked in version 8u211
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Given that a proper "Icon_information_128x128.png" with dimensions of 128x128 pixels is placed next to the test case, execute the following code with both Java8u201 and Java8u212:
EventQueue.invokeAndWait(() -> {
URL img = this.getClass().getResource("Icon_information_128x128.png");
JButton btn = new JButton("Test");
btn.setToolTipText("<html>This is a test tooltip: <img src=\"" + img + "\"/></html>");
JDialog dlg = new JDialog();
dlg.setLocationByPlatform(true);
dlg.getContentPane().add(btn);
dlg.setModal(true);
dlg.pack();
dlg.setVisible(true);
});
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
There must be an image shown in the tool tip next to "This is a test tooltip: " when mouse is place on the button labeled "Test"
ACTUAL -
No image is seen in the tool tip, just the text "This is a test tooltip: "
---------- BEGIN SOURCE ----------
public class JavaBugs
{
public void toolTipHtmlImageBug() throws InvocationTargetException, InterruptedException
{
EventQueue.invokeAndWait(() -> {
URL img = this.getClass().getResource("Icon_information_128x128.png");
JButton btn = new JButton("Test");
btn.setToolTipText("<html>This is a test tooltip: <img src=\"" + img + "\" /></html>");
JDialog dlg = new JDialog();
dlg.setLocationByPlatform(true);
dlg.getContentPane().add(btn);
dlg.setModal(true);
dlg.pack();
dlg.setVisible(true);
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Extract and set image dimensions on the <img/> tag like:
btn.setToolTipText("<html>This is a test tooltip: <img src=\"" + img + "\" width=128 height=128 /></html>");
FREQUENCY : always