JDK-8218897 : Tooltip with image and text shows only text
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8u202,11.0.2,12,13
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • CPU: x86
  • Submitted: 2019-02-12
  • Updated: 2019-02-13
  • Resolved: 2019-02-13
Related Reports
Duplicate :  
Description
ADDITIONAL SYSTEM INFORMATION :
Java: 13-ea; OpenJDK 64-Bit Server VM 13-ea+7
System: Mac OS X version 10.13.6 running on x86_64; UTF-8; en_DE

A DESCRIPTION OF THE PROBLEM :
image is no longer displayed in tooltip with jdk-11.0.2 and JDK 13-ea+7 and JDK 1.8.0_202-ea-b03

String tooltiptext = "<html>" + "This is the "
        + "<img src=\"file:Duke_Wave.png\">" + " tool tip text." + "</html>";
    button.setToolTipText(tooltiptext);


REGRESSION : Last worked in version 13

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the provided code

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Tooltip with image and text shows both
ACTUAL -
Tooltip with image and text shows only text

---------- BEGIN SOURCE ----------
import java.awt.BorderLayout;

import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class Main {
  public static void main(String[] args) {
    JFrame frame = new JFrame();
    JComponent button = new JButton("Tooltip");
    String tooltiptext = "<html>" + "This is the "
        + "<img src=\"file:Duke_Wave.png\">" + " tool tip text." + "</html>";// use any png image instead of Duke_Wave.png
    button.setToolTipText(tooltiptext);
    JPanel panel = new JPanel();
    panel.add(button);
    frame.add(panel, BorderLayout.CENTER);
    frame.setSize(500, 400);
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
}
---------- END SOURCE ----------

FREQUENCY : always



Comments
Reported with JDK 11.0.2, 13, and 8u202, the tooltip with image and text fails to show image. Checked this for reported version in macOS X 10.13.6 and Windows 10 and could confirm the issue. Result: ====== 8u201: Ok 8u202: Fail 11.0.1: Ok 11.0.2: Fail 12 ea b31: Fail 13 ea b07: Fail To verify, run the attached test case with respective JDK versions. The image fails to display in JDK 8u202 and 11.0.2 including 12 ea and 13 ea. The issue is not specific to mac and does reproduce equally in Windows.
13-02-2019