Name: gm110360 Date: 05/23/2002
FULL PRODUCT VERSION :
java version "1.3.1_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_03-b03)
Java HotSpot(TM) Client VM (build 1.3.1_03-b03, mixed mode)
FULL OPERATING SYSTEM VERSION : Windows NT Version 4.0
sp6
A DESCRIPTION OF THE PROBLEM :
Using JEditorPane's setUrl(new URL("http://java.sun.com"))
you get weird formatting for the banner at top of the page
and generally the table formatting is a mess.
This happens with jdk 1.3.1_01 also.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. see source code
2.
3.
EXPECTED VERSUS ACTUAL BEHAVIOR :
I tried to use the JEditorKit and JTextPane to build a
simple browser
and others seem to have been able to do it this way, but
the actual display is terrible. The positioning and
size of many page elements is totally wrong, and some
images are from other pages than the one being
accessed. Anyone have experience with this?
ERROR MESSAGES/STACK TRACES THAT OCCUR :
no exceptions or errors. just terrible page formatting.
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
I tried to use the JEditorKit and JTextPane to build a simple browser
and others seem to have been able to do it this way, but
the actual display is terrible. The positioning and
size of many page elements is totally wrong, and some
images are from other pages than the one being
accessed. Anyone have experience with this?
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.text.html.*;
import javax.swing.text.html.parser.*;
import java.awt.*;
import java.io.*;
import java.net.*;
class TestJEditorComponent {
static JFrame f = new JFrame("TestJTextComponent");
static JEditorPane editor = new JEditorPane();
public static void main(String[] args) {
try {
f.getContentPane().add(new JScrollPane(editor));
editor.setEditable(false);
// banner is terrible
editor.setPage(new URL("http://java.sun.com"));
// this gives a total mess
//editor.setPage(new URL("http://cnn.com"));
f.setSize(400,400);
f.setLocation(300,300);
f.show();
} catch (Throwable e) { e.printStackTrace(); }
}
}
---------- END SOURCE ----------
(Review ID: 143555)
======================================================================