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

Incorrect layout for multi-lines HTML text in JLabel

    XMLWordPrintable

Details

    • kestrel
    • generic
    • generic

    Description



      Name: skT88420 Date: 08/04/99


      When a long (multi-lines) HTML text is used for a JLabel of fixed size, the text's position is too low on the first label's painting. Next paintings (for example when the window's label is restored after being iconified) are ok. Please compile and try the test case below. This test case has been tested on Windows 95 with JDK 1.2.2 and the Metal look and feel.


      import javax.swing.*;

      class Test
      {
        static void main(String[] args)
        {
          JLabel label=new JLabel(
              "<html><body><p>"+
              "<strong>Layout problem with HTML text "+
              "in JLabel.</strong> Please look at "+
              "this HTML text. The first time the "+
              "label is paint, the layout doesn't "+
              "seem to be correct (the text's position "+
              "is too low). If you iconified this "+
              "window and then restore it, everything "+
              "become okay."+
              "</p></body></html>");

          JFrame frame=new JFrame();
          frame.getContentPane().add(label);
          frame.setSize(300,200);
          frame.show();
        }
      }
      (Review ID: 93464)
      ======================================================================

      Attachments

        Activity

          People

            tprinzing Tim Prinzing
            skonchad Sandeep Konchady
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: