-
Bug
-
Resolution: Fixed
-
P3
-
1.2.2
-
beta2
-
generic
-
generic
Name: skT88420 Date: 09/30/99
I have been using JEditorPane to display an HTML Pane within
a JScrollPane. In JDK versions 1.2 and prior, there were no
problems. In JDK 1.2.2, though, when I have a large HTML
table for display, the JScrollPane does not recognize the size
of the table, and cuts it by the size of the JScrollPane.
When I resize the window, and thus the JScrollPane, more of
the table is visible, but there is a line in the table where
the old JScrollPane boundaries were. There is also no
Horizontal ScrollBar in the ScrollPane. If the Horizontal
ScrollBar is set to always, it appears, but you cannot
scroll to the unseen portion of the table.
I have also tried getScrollableTracksViewportWidth returning false,
unsuccessfully.
Below is the code used to produce the JScrollPane. Please
let me know of any changes in JDK1.2.2 that may be causing this
problem
public class TableReporter extends JDialog{
private JEditorPane area;
private JScrollPane scroll;
private String mFinal = "";
private String mBegin = "";
private String mTable = "";
private String mEnd = "";
private String mList = "";
public TableReporter() {
super();
getContentPane().setLayout(new BorderLayout());
getContentPane().add(createMainPanel(), BorderLayout.CENTER);
setSize(640, 400);
setVisible(true);
}
public JScrollPane createMainPanel(){
String text = generateText();
area = new JEditorPane("text/html", text);
scroll = new JScrollPane(area, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS){
public boolean getScrollableTracksViewportWidth(){
return false;
}
};
scroll.revalidate();
return scroll;
}
public String generateText(){
mBegin = "<!doctype html public \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n" +
"<html>\n" +
"<head>\n" +
" <title>LargeTable</title>\n" +
" <link rel=\"STYLESHEET\" type=\"text/css\" href=\"msa.css\">\n" +
"</head>\n" +
"\n" +
"<body bgcolor=#ffffff text=#000000>\n" +
"\n" +
"<center>\n" +
"<table width=600 height=100% border=0 cellspacing=5 cellpadding=5>\n" +
"<tr>\n" +
"<td align=center colspan=5>\n" +
"<h1>TooManyColumns</h1>\n" +
"\n";
mTable = "<table width=600 border=1 cellspacing=0 cellpadding=8>\n" +
"<tr bgcolor=#99ccff>\n" +
"<td align=center><b></b></td>\n";
for (int k=0; k<20; k++){
mList = "<td align=center><b>TableColumn</b></td>\n";
mTable = mTable.concat(mList);
}
mList = "</tr>\n" +
"\n";
mTable = mTable.concat(mList);
for (int i=0; i<3; i++){
mList = "<tr>\n" +
"<td align=center>values</td>\n";
mTable = mTable.concat(mList);
for (int j=0; j<20; j++){
mList = "<td align=center>20</td>\n";
mTable = mTable.concat(mList);
}
mList = "</tr>\n";
mTable = mTable.concat(mList);
}
mList = "<tr bgcolor=#99ccff>\n" +
"<td align=center>TOTALS</td>\n";
mTable = mTable.concat(mList);
for (int i=0; i<20; i++){
total = 0;
for (int j=0; j<3; j++){
total += 20;
}
mList = "<td align=center>" + total + "</td>\n";
mTable = mTable.concat(mList);
}
mList = "</tr>\n" +
"</table>\n";
mTable = mTable.concat(mList);
mEnd = "<p>\n" +
"\n" +
"</td>\n" +
"</tr>\n" +
"</table>\n" +
"\n" +
"</center>\n" +
"</body>\n" +
"</html>\n";
mFinal = mBegin + mTable + mEnd;
return mFinal;
}
public static void main(String args[])
{
new TableReporter();
}
}
(Review ID: 95995)
======================================================================