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

The HTMLEditorKit's read() method doesn't handle the <BR> tag

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.2beta4
    • CPU:
      x86
    • OS:
      windows_nt
    • Verification:
      Not verified

      Description

      The HTMLEditorKit's read() method doesn't handle the <BR> tag. However <BR></BR> is working fine.


      import com.sun.java.swing.*;
      import com.sun.java.swing.text.*;
      import com.sun.java.swing.text.html.*;
      import java.awt.*;
      import java.io.*;

      class TestHtmlPane extends JPanel {
          JTextPane editor;
          StyledDocument document;
          JToolBar toolbar;

          public TestHtmlPane(){
              super(new BorderLayout());
              editor=new JTextPane();
              HTMLEditorKit editKit = new HTMLEditorKit();
              document = (StyledDocument)editKit.createDefaultDocument();
              Reader in = new StringReader("<HTML><HEAD><TITLE>Test</TITLE></HEAD><BODY>First line<BR>Second line</BODY></HTML>");
              try{
                  editor.setStyledDocument((StyledDocument)editKit.read(in, null));
              } catch (IOException ex){
                  ex.printStackTrace();
              }
              this.add(editor, BorderLayout.CENTER);
          }

          public static void main(String[] args){
              JFrame frame=new JFrame();
              frame.setSize(400, 400);
              frame.getContentPane().add(new TestHtmlPane());
              frame.setVisible(true);
          }
      }

      ==========================================================================
      carlos.lucasius@canada 1998-03-13:
      Similar bug reported by Corel (licensee) for JFC1.1 using JDK1.1.4 on WINNT4.0.
      Corel: "Very critical bug for our product - requires immediate attention."

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              smanisunw Sunita Mani (Inactive)
              Reporter:
              bkimsunw Bae-chul Kim (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: