-
Bug
-
Resolution: Fixed
-
P3
-
1.1.4, 1.2.0
-
1.2beta4
-
x86
-
windows_nt
-
Not verified
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."
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."
- relates to
-
JDK-4119546 The HTMLEditorKit's read() method ignores spaces that shouldn't be ignored
- Closed