Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8218897

Tooltip with image and text shows only text

XMLWordPrintable

      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


        1. Duke_Wave.png
          Duke_Wave.png
          12 kB
        2. Main.java
          0.7 kB

            kaddepalli Krishna Addepalli
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: