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

HTML style element not handled

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 5.0
    • 1.4.1
    • client-libs
    • tiger
    • x86
    • windows_xp



      Name: gm110360 Date: 02/05/2003


      FULL PRODUCT VERSION :
      java version "1.4.1_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
      Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      JLabel does not handle the HTML 'style' tag, the content
      of the tag is displayed. Setting the 'style' attribute in
      the 'span' tag also does not work. See the example code.
      In each case the word 'word' should be in red, but this
      only happens for the third case, using the
      deprecated 'font' tag. The HTML displays correctly in a
      browser.



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Run the code supplied
      2.
      3.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      On each label, the word 'word' should be red.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class JLabelTest extends javax.swing.JFrame {
          private final static String s1 = "<html><style type=\"text/css\">
      span.highlight { color:red; }</style><body>This <span
      class=\"highlight\">word</span> should be red</body></html>";
          private final static String s2 = "<html><body>This <span
      style=\"color:red\">word</span> should be red</body></html>";
          private final static String s3 = "<html><body>This <font
      color=\"red\">word</font> should be red</body></html>";
          
          public JLabelTest() {
              super("JLabel HTML Test");
              java.awt.Container contentPane = getContentPane();
              contentPane.setLayout(new java.awt.GridLayout(0, 1, 5, 5));
              javax.swing.JLabel label1 = new javax.swing.JLabel(s1);
              javax.swing.JLabel label2 = new javax.swing.JLabel(s2);
              javax.swing.JLabel label3 = new javax.swing.JLabel(s3);
              contentPane.add(label1);
              contentPane.add(label2);
              contentPane.add(label3);
              pack();
              setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
          }
          
          public static void main(String[] args) {
              (new JLabelTest()).setVisible(true);
          }
      }

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

      CUSTOMER WORKAROUND :
      Use the deprecated HTML 'font' tag instead.
      (Review ID: 180565)
      ======================================================================

            sdvsunw Sdv Sdv (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: