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

JLabel with an html img src not working anymore

    Details

    • Subcomponent:
    • Introduced In Version:
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10 (update 1809)

      Java 8u201 -> working
      Java 8u202 -> not working
      Java 11.0.2 -> not working
      Java 12 -> not working

      A DESCRIPTION OF THE PROBLEM :
      Having a JLabel with a text set to an html snippet containing an 'img src="https://...."' tag, does not work as expected, starting from 8u202 while working correctly in 8u201.
      It does not work as well with 11.0.2 and 12

      REGRESSION : Last worked in version 8u201

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Execute the included test program to open a jframe displaying an oracle logo an some text

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Both the oracle logo and the text should be visible
      ACTUAL -
      With java 8u202, 11.0.2 and 12, the oracle logo is not visible, while the text is ok.

      ---------- BEGIN SOURCE ----------
      import java.awt.BorderLayout;
      import java.awt.Font;
      import java.net.URISyntaxException;

      import javax.swing.JFrame;
      import javax.swing.JLabel;

      public class HtmlImgSrcTest
      {
        public static void main(String[] args) throws URISyntaxException
        {
            JFrame frame = new JFrame();
            frame.setLayout(new BorderLayout());
            JLabel label = new JLabel(
                "<html>"
                + "Hello "
                + "<img src=\"https://media.smau.it/x-exhibition/upload/partner/2014/06/12/oracle2014.jpg\">"
                + " World</html>");
            label.setFont(new Font("Tahoma", Font.PLAIN, 30));
            frame.add(label, BorderLayout.CENTER);
            frame.setBounds(100, 100, 700, 300);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
         }
       }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Have not found a full workaround.
      Using a <div style="background-image: url('http://.....&#39;)" /> works only partially because of the div itself (and changing display property does not give ant effect..)

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kaddepalli Krishna Addepalli
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: