JDK-4690812 : poor formatting of complex pages by JEditorPane, e.g. java.sun.com
  • Type: Bug
  • Status: Resolved
  • Resolution: Fixed
  • Component: client-libs
  • Sub-Component: javax.swing
  • Priority: P4
  • Affected Version: 1.3.1,1.4.2_16,1.4.2_17-rev
  • OS: solaris_10,windows,windows_nt
  • CPU: generic,x86,sparc
  • Submit Date: 2002-05-23
  • Updated Date: 2003-09-05
  • Resolved Date: 2003-09-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
Other
1.4.2_21Resolved
Related Reports
Duplicate :  
Relates :  
Relates :  
Description

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) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b19
2004-06-14

EVALUATION Name: dsR10138 Date: 06/15/2003 I could see three issues when displaying the java.sun.com page: 1. Fonts are too large in comparison with other browsers. This happens because of incorrect font scaling when parsing CSS font-size attributes. However this is a standalone bug 4765271. It should be fixed. 2. Tables look awful because of the known problem of adding one line after an image in a table. This is the bug 4623342 which also should be fixed. 3. Table column widths are not correctly adjusted when their total size is greater then 100%. This is needed to be fixed within this bug. The idea of the fix is to distinguish adjustment weights of cells with percentage width values and with fixed width values. Adjustment weight of the percentage cells should be the worst, since they are more scalable then cells with the fixed width. ###@###.### 2003-06-15 ======================================================================
2003-06-15