United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4690812 poor formatting of complex pages by JEditorPane, e.g. java.sun.com
JDK-4690812 : poor formatting of complex pages by JEditorPane, e.g. java.sun.com

Details
Type:
Bug
Submit Date:
2002-05-23
Status:
Resolved
Updated Date:
2003-09-05
Project Name:
JDK
Resolved Date:
2003-09-05
Component:
client-libs
OS:
windows_nt,solaris_10,windows
Sub-Component:
javax.swing
CPU:
x86,sparc,generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.3.1,1.4.2_16,1.4.2_17-rev
Fixed Versions:
5.0 (tiger)

Related Reports
Backport:
Duplicate:
Relates:
Relates:

Sub Tasks

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
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
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
tiger

FIXED IN:
tiger

INTEGRATED IN:
tiger
tiger-b19


                                     
2004-06-14



Hardware and Software, Engineered to Work Together