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

Erroneous rendering of table-cell contents in JEditorPane/HTML content

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.4.2
    • client-libs



      Name: rmT116609 Date: 10/22/2003


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

      java version "1.4.2_02"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_02-b03)
      Java HotSpot(TM) Client VM (build 1.4.2_02-b03, mixed mode)

      FULL OS VERSION :
      Microsoft Windows 2000 [Version 5.00.2195]

      A DESCRIPTION OF THE PROBLEM :
      The JEditorPane does not render the content in accordance with prevailing browser standards when a table-cell contains text as well as another table. The following example examplifies the problem.



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Copy the attached HTML file to a location in your file system. Adjust the URL in the constructer method in the attached program and compile. Run the program and compare with the result produced by other browsers (MS Internet Explorer, Mozilla...)



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Rendering of content in accordance with prevaililng browser.
      ACTUAL -
      Inability to allign text with a new table in a table cell.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.HeadlessException;
      import java.io.IOException;
      import java.net.URL;
      import javax.swing.JEditorPane;
      import javax.swing.JFrame;
      import javax.swing.JScrollPane;


      public class TestHTML extends JFrame {

      public TestHTML() throws HeadlessException
      {
      setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
      setTitle("Test of HTML rendering");
      setSize(700, 700);

      JEditorPane ePane = new JEditorPane();
      ePane.setDocument(new javax.swing.text.html.HTMLDocument());
      ePane.setContentType("text/HTML");
      JScrollPane scrollPane = new JScrollPane();
      scrollPane.setViewportView(ePane);

      try {
      // Please modify URL below to match your file location
      URL url = new URL("file:///d:/HTMLTemplate2.html");
      ePane.setPage(url);
      }
      catch(IOException e1) {
      ;
      }

      getContentPane().add(scrollPane, "Center");
      }

      public static void main(String[] args)
      {
      (new TestHTML()).show();
      }
      }

      <html>
        <head>
          <title>Dummy Head</title>
        </head>
        <body>
          <table border="0" width="600" cellspacing="0" cellpadding="5">
            <tr>
              <td valign="top" width="490">
                <table width="490" border="0" cellspacing="0" cellpadding="10">
                  <tr>
                    <td valign="top" width="460">
                      <h1>Dummy Head</h1>
                      <p>
                      </p>
                      <h2>Dummy Subhead</h2>
                      <p>
                      </p>
                      <h3>Dummy Intro</h3>
                      <p>
                      </p>
                      <table border="0" align="right" cellpadding="10" cellspacing="10" valign="top" width="200">
                        <tr>
                          <td align="right">
                            <img border="1" src="file:///d:/picture.jpg" width="180">
                            <font size="-1" face="arial,helvetica">Dummy Caption -
                            This is dummy text. Please do not print this text. This
                            is just for example. For position only. Please do not
                            run this text. This is fake copy. It ain't the real
                            McCoy. Don't be fooled, it's only a placebo. Do not run
                            this copy please. </font
                            <p>
                            </p>
                            <hr>
                          </td>
                        </tr>
                      </table>
                      <blockquote>
                        By Morten Schousen<br>CCI Europe<br><i>Dec. 24. 1997</i>
                      </blockquote>
                      <p>
                        DUMMYTEXT - This is dummy text. Please do not print this
                        text. This is just for example. For position only. Please do
                        not run this text. This is fake copy. It ain't the real
                        McCoy. Don't be fooled, it's only a placebo. Do not run this
                        copy please. This is dummy text. Please do not print this
                        text. This is just for exam-ple. For position only. Please
                        do not run this text. This is fake copy. It ain't the real
                        McCoy. Don't be fooled, it's only a placebo. Do not run this
                        copy please.
                      </p>
                      <p>
                        This is dummy text. Please do not print this text. This is
                        just for example. For position only. Please do not run this
                        text. This is fake copy. It ain't the real McCoy. Don't be
                        fooled, it's only a placebo. Do not run this copy please.
                      </p>
                      <p>
                        This is dummy text. Please do not print this text. This is
                        just for example. For position only. Please do not run this
                        text. This is fake copy. It ain't the real McCoy. Don't be
                        fooled, it's only a placebo. Do not run this copy please.
                      </p>
                    </td>
                  </tr>
                </table>
              </td>
            </tr>
          </table>
        </body>
      </html>

      ---------- END SOURCE ----------
      (Incident Review ID: 209363)
      ======================================================================

            naasunw Naa Naa (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: