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

HTML text in JLabel does not use LnF's font

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.3.0
    • client-libs
    • beta
    • generic, x86
    • generic, linux



      Name: jk109818 Date: 06/29/2000


      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      As of bug ID #4248210, JLabel now use LnF's foreground color. But it does not
      use LnF's font. It result in different aspects for default JLabel and HTML
      JLabel. The following code illustrate it:

      import java.awt.*;
      import javax.swing.*;

      public class Test
      {
          public static void main(String[] args)
          {
              final Font font=new Font("Helvetica", Font.PLAIN, 16);
              final JFrame frame=new JFrame();
              final JPanel panel=new JPanel(new GridLayout(4,1));
              final JLabel label1=new JLabel("There is an ordinary label");
              final JLabel label2=new JLabel("<html>There is an <em>HTML</em>
      label</html>");
              final JLabel label3=new JLabel("There is an ordinary label in Helvetica
      16");
              final JLabel label4=new JLabel("<html>There is an <em>HTML</em> label
      supposed to be in Helvetica 16</html>");

              label3.setFont(font);
              label4.setFont(font);
              panel.add(label1);
              panel.add(label2);
              panel.add(label3);
              panel.add(label4);
              frame.setContentPane(panel);
              frame.pack();
              frame.show();
          }
      }

      Calling "JLabel.setFont(Font)" doesn't help. I would like that JLabel use LnF's
      font. If it is not possible for compatibility raison, I would like that
      calling "JLabel.setFont(Font)" change the default label's font.

      Thanks
      (Review ID: 106580)
      ======================================================================

            svioletsunw Scott Violet (Inactive)
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: