Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4764897
Votes 1
Synopsis Text and borders in HTML tables run over right edge
Category java:classes_swing
Reported Against 1.4.1
Release Fixed 1.5(tiger)
State 10-Fix Delivered, bug
Priority: 4-Low
Related Bugs
Submit Date 17-OCT-2002
Description




FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

AND

java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)

FULL OPERATING SYSTEM VERSION :
Windows 98 [Version 4.10.2222]



A DESCRIPTION OF THE PROBLEM :
Significant drawing errors can occur for the rightmost
column of HTML tables in JTextPane.  For certain text and
widths, text in the right column will fail to wrap properly
within the HTML table cell and can overshoot the right table
border by several characters.

Likewise, the HTML table horizontal border lines can also
overshoot the right edge vertical border line by many
pixels, even when the text does not.

The effect is exaggerated by using setMargin to specify a
large margin for the JTextPane, but also occurs for the
default margin.  The offending horizontal border lines
appear to extend across the entire JTextPane right margin.

The problem occurs only for certain HTML table contents.  It
appears to be triggered when an earlier cell of the HTML
table has a non-breaking word of size greater than its cell
width.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile and run the program below


EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected:
Text should wrap withing HTML table cells, horizontal border
lines should end at the right table edge.

Actual:
Text overshoots right table edge by several characters,
horizontal border lines extend beyond the right table edge
across the entire right JTextPane margin.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.*;
import javax.swing.*;

class Test {
    static JTextPane pane;
    
    static public void main(String args[]){
        pane = new JTextPane();
        pane.setContentType("text/html");
        pane.setText("<html>"

        +"<html><head><table border>"
        +"<tr><td width=20%>one</td><td width=20%>&nbsp;</td>"
        +"<td width=20%>two</td><td width=40%>"
        +"This is text that won't get displayed correctly.<td></tr>"

        +"<tr><td width=20%>three</td><td width=20%>&nbsp;</td>"
        +"<td width=20%>four</td><td width=40%>"
        +"Here is some added text which won't get displayedcorrectly.</td></tr>"

        +"<tr><td width=20%>five</td><td width=20%>&nbsp;</td>"
        +"<td width=20%>six</td><td width=40%>"
        +"This text will have greater difficulty at displaying correctly.</td></tr>"

        +"<tr><td width=20%>seven</td><td width=20%>&nbsp;</td>"
        +"<td width=20%>ThisIsAnExtraWideWord</td><td width=40%>"
        +"Like all the others, this text will be unlikely to display
correctly.</td></tr>"
        +"</td></tr>"

        +"</table></body></html>");

        JFrame frame = new JFrame("Printing test");
        pane.setMargin(new Insets(25,25,25,25)); // exaggerates the effect
        frame.getContentPane().add(pane);
        frame.setSize(600,800);
        frame.setVisible(true);
        System.out.println("Hit <Enter> to continue");
        try { System.in.read(); } catch (Exception e) {}
        System.exit(0);
    }
    
}


---------- END SOURCE ----------

CUSTOMER WORKAROUND :
Changing the wording of text in the HTML table can often
produce text that will wrap correctly, but borders can still
come out wrong.
(Review ID: 164054) 
======================================================================
Work Around
N/A
Evaluation





won't fix it for mantis. will fix it for tiger

 xxxxx@xxxxx  2002-11-05


======================================================================





The bug exists because TableView.ColumnIterator.getMinimumSpan(...)
returns incorrect value.


 xxxxx@xxxxx  2002-11-05


======================================================================
Comments
  
  Include a link with my name & email   

Submitted On 09-OCT-2003
msenin
This problem still exists in JDK 1.4.2-b28. Please re-open
this bug. The text is not wrapping correctly, and frequently
the border of the cell of inner table can go over the right
edge of the border of the cell in outer table. Bug is
reproduceable always with HTML tables nested 4+ levels.


Submitted On 18-DEC-2003
msenin
It still exists in 1.4.2_03


Submitted On 18-JUL-2004
ben000
Still exists in 1.4.2_04.
Also occurs with embedded img tags that have a specified width greater than the TD's specified width.
Please reopen.


Submitted On 10-AUG-2004
ASoltesz
This is a very annoying problem and almost everybody using HTML bumps into it. It is especially problematic because renders JavaHelp useless on 1.4.2 (all of the tables in HTML pages are displayed incorrectly).

Please, correct it in the 1.4.2 series as well, not only in Tiger (1.5). It will take some time people can move their applications to Tiger and this is an important bug.


Submitted On 26-JUL-2006
dingfelder
Still a bug in jdk1.5.0_07



PLEASE NOTE: JDK6 is formerly known as Project Mustang