-
Bug
-
Resolution: Fixed
-
P4
-
5.0
-
b53
-
x86
-
windows_2000
FULL PRODUCT VERSION :
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
The BGCOLOR attribute of an HTML TABLE in JEditorPane is not rendered.
I think that this is due to a change in TableView between 1.4.2 and 1.5.
The paint method of javax.swing.text.html.TableView included the line
painter.paint(g, a.x, a.y, a.width, a.height, this);
But this is now:
for (int i = borderWidth; i > 0; i--) {
painter.paint(g, a.x + i, a.y + i, a.width - 2 * i, a.height - 2 * i, this);
}
I think the loop condition should be "i >= 0" instead of "i > 0".
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Set up JEditorPane like this:
JEditorPane editorPane =
new JEditorPane("text/html",
"<HTML><TABLE bgcolor='red'>" +
"<TR><TD>Background should be red</TD></TR>" +
"</TABLE></HTML>");
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The background of the text should be red.
ACTUAL -
The background was white.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
public class TableViewBug extends JFrame
{
public TableViewBug()
{
super("Table View Bug");
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public void display()
{
JEditorPane editorPane =
new JEditorPane("text/html",
"<HTML><TABLE bgcolor='red'>" +
"<TR><TD>Background should be red</TD></TR>" +
"</TABLE></HTML>");
getContentPane().add(editorPane);
pack();
setVisible(true);
}
static public void main(String args[])
{
TableViewBug tableViewBug = new TableViewBug();
tableViewBug.display();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Apply the BGCOLOR attribute to the TR element instead of the TABLE
###@###.### 2004-12-09 10:36:45 GMT
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
The BGCOLOR attribute of an HTML TABLE in JEditorPane is not rendered.
I think that this is due to a change in TableView between 1.4.2 and 1.5.
The paint method of javax.swing.text.html.TableView included the line
painter.paint(g, a.x, a.y, a.width, a.height, this);
But this is now:
for (int i = borderWidth; i > 0; i--) {
painter.paint(g, a.x + i, a.y + i, a.width - 2 * i, a.height - 2 * i, this);
}
I think the loop condition should be "i >= 0" instead of "i > 0".
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Set up JEditorPane like this:
JEditorPane editorPane =
new JEditorPane("text/html",
"<HTML><TABLE bgcolor='red'>" +
"<TR><TD>Background should be red</TD></TR>" +
"</TABLE></HTML>");
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The background of the text should be red.
ACTUAL -
The background was white.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
public class TableViewBug extends JFrame
{
public TableViewBug()
{
super("Table View Bug");
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public void display()
{
JEditorPane editorPane =
new JEditorPane("text/html",
"<HTML><TABLE bgcolor='red'>" +
"<TR><TD>Background should be red</TD></TR>" +
"</TABLE></HTML>");
getContentPane().add(editorPane);
pack();
setVisible(true);
}
static public void main(String args[])
{
TableViewBug tableViewBug = new TableViewBug();
tableViewBug.display();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Apply the BGCOLOR attribute to the TR element instead of the TABLE
###@###.### 2004-12-09 10:36:45 GMT
- relates to
-
JDK-4174871 JEditorPane ignores table border size
-
- Resolved
-
-
JDK-4174874 JEditorPane ignores CELLSPACING attribute in TABLE tag
-
- Resolved
-