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

JLabel with HTML formatted text is visible only for the first time

XMLWordPrintable

    • b02
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.6.0_23"
      Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
      Java HotSpot(TM) Client VM (build 19.0-b09, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Java Plug-in 1.6.0_23
      Used browser:
      1) Firefox 3.6.13
      2) Internet Explorer 8.0.6001
      3) Internet Explorer 7.0.6002
      4) Internet Explorer 9.0.8112

      A DESCRIPTION OF THE PROBLEM :
      We are using applets with JLabels. These labels are containing html formatted texts. The html formatted text are shown only for the first time when calling the applet. After reloading the browser page the JLabel text is empty.
      This error occurs since JRE 1.6.0_22.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      please refer to the example code


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      java source:
      ----------------

      package com.test;

      /**
       *
       */
      public class JLabelProblem extends javax.swing.JApplet {

          @Override
          public void init() {
              try {
                  javax.swing.SwingUtilities.invokeAndWait(new Runnable() {

                      public void run() {
                          javax.swing.JPanel topPanel = new javax.swing.JPanel();
                          topPanel.setLayout(new java.awt.BorderLayout());
                          getContentPane().add(topPanel);

                          topPanel.add(new javax.swing.JLabel("<html>Hello World - with HTML!</html>"), java.awt.BorderLayout.NORTH);
                          topPanel.add(new javax.swing.JLabel("Hello World - without HTML!"), java.awt.BorderLayout.SOUTH);
                      }
                  });

              } catch (Exception e) {
                  System.err.println("Couldn't initialize GUI");
              }
          }
      }


      html code:
      --------------

      <html>
      <head>
        <title>HTML formatted JLabel problem</title>
      </head>
      <body>
            <applet height="50" width="200" archive="JLabelProblem.jar" code="com.test.JLabelProblem"/>
      </body>
      </html>

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      There is no workaround

            vkarnauk Vladislav Karnaukhov
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: