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

JEditorPane is unable to do reasonably spaced indentation in complex HTML tables

XMLWordPrintable

    • b86
    • sparc
    • solaris_8

        JEditorPane is unable to do reasonably spaced indentation. The indentation distance
        is much too long. The problem gets even worse with 1.4.2 and 1.5.0.

        The problem is strictly reproducible:

        1. Testcase
        -----------
        Please find entire testcase attached:

        % more Test.java
        import java.awt.*;
        import java.awt.event.*;
        import java.io.*;
        import java.net.*;
        import javax.swing.*;
        import javax.swing.text.*;
        import javax.swing.text.html.*;

        public class Test extends JFrame
        {
          JEditorPane txt;
          HTMLEditorKit c;
          HTMLDocument doc;

          class WindowClose extends WindowAdapter {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
          }

          public Test()
          {
            super("Test");
            setSize(500,300);
            addWindowListener(new WindowClose());
            JEditorPane jep = new JEditorPane();
            jep.setEditable(false);
            HTMLEditorKit c= new HTMLEditorKit();
            jep.setEditorKit(c);
            try {
              jep.setPage(getClass().getResource("D-KA-0008170.html"));
            } catch (Exception e) {}
            HTMLDocument doc=(HTMLDocument)jep.getDocument();
            getContentPane().add(new JScrollPane(jep));
            setVisible(true);
          }

          public static void main(String argv[])
          {
            new Test();
          }
        }

        2. Compile and run
        ------------------
        % make
        /j2sdk1_3_1_16/bin/javac Test.java
        % make run
        /j2sdk1_3_1_16/bin/java -version
        java version "1.3.1_16"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_16-b06)
        Java HotSpot(TM) Client VM (build 1.3.1_16-b06, mixed mode)
        /j2sdk1_3_1_16/bin/java Test
        [ application window will appear ... ]

         Please note that the indentaion is correct however the indentation offset of
         all dashed items is much too long.

        3. Display html in browser like mozilla and compare

              idk Igor Kushnirskiy (Inactive)
              thlenz Thomas Lenz (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: