Name: jk109818 Date: 06/21/2002
FULL PRODUCT VERSION :
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b14)
Java HotSpot(TM) Client VM (build 1.4.1-beta-b14, mixed mode)
FULL OPERATING SYSTEM VERSION :
glibc-2.2.4-24
Linux 2.4.9-31 #1 Tue Feb 26 07:11:02 EST 2002 i686 unknown
Red Hat Linux release 7.1 (Seawolf)
A DESCRIPTION OF THE PROBLEM :
The width=100% HTML table attribute is not respected in a
JEditorPane placed in a JScrollPane, i.e. the table does not
take up 100% of the available space. It does work as
expected if the JEditorPane is not placed in a JScrollPane.
It also worked as expected in JRE 1.4.0 and JRE 1.3.x
REGRESSION. Last worked in version 1.4
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile and run the HTMLTableBug.java (below)
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expect both HTML tables to occupy 100% of the available
horizontal space.
Result (for 1.4.1 beta) is that the html table in a
JScrollPane does not occupy 100% of the space.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
public class HTMLTableBug extends JFrame
{
final String html = "<html>\n<body>\n<table border=1 width=100%
bgcolor=#ff0000><tr><td>test 1</td></tr></table>\n</body>\n</html>\n";
public HTMLTableBug()
{
super("HTMLTableBug");
JScrollPane scroll = new JScrollPane();
JEditorPane pane = getPane();
scroll.getViewport().add(pane);
scroll.setBorder(new TitledBorder("With scrollpane"));
pane = getPane();
pane.setBorder(new TitledBorder("W/o scrollpane"));
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.add(scroll);
panel.add(pane);
panel.setPreferredSize(new Dimension(400, 400));
getContentPane().add(panel);
addWindowListener(new WindowEventHandler());
pack();
show();
}
JEditorPane getPane()
{
JEditorPane pane = new JEditorPane();
pane.setContentType("text/html");
pane.setText(html);
return pane;
}
class WindowEventHandler extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
public static void main(String[] args)
{
new HTMLTableBug();
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
Don't use table % width tags...
Release Regression From : 1.4
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Review ID: 153967)
======================================================================