-
Bug
-
Resolution: Fixed
-
P3
-
1.3.0, 1.3.1, 1.4.0, 5.0, 5.0u10, 6, 7, 7u6
-
b59
-
generic, x86
-
generic, windows_xp
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8084632 | emb-9 | Alexandr Scherbatiy | P3 | Resolved | Fixed | team |
JDK-2151268 | 6-pool | Vladislav Karnaukhov | P3 | Closed | Other | |
JDK-2149318 | 5.0-pool | Vladislav Karnaukhov | P4 | Closed | Other |
Name: bsC130419 Date: 06/21/2001
Found in: J2SE 1.3.0 (build 1.3.0-C)
Also in: J2SE 1.4.0-beta (build 1.4.0-beta-b65)
This appears to be a problem with the rendering of JTable headers, such that
the header does not redraw properly when the table and header are horizontally
scrolled.
Steps:
1) Create a JTable and a simple model with several columns.
2) Set the JTable setAutoResizeMode to JTable.AUTO_RESIZE_OFF.
3) Add the JTable to a JScrollPane.
4) Manually set the preferred size of the JTable's header.
5) Place the whole lot in a JFrame and display it.
Now, if you resize the window so that some of the JTable's columns do not fit
you get a scroll bar as expected. Dragged the scroll bar to the right; the
header does not repaint the headers for the new columns that have become
visible (though the columns themselves look okay). The header display becomes
corrupt.
It appears as though the all pixels for the previously visible part of the
header have been shifted left okay, but the right-most fragment of the old
visible header region has been redrawn on the far right, rather than a new
rectangular section representing the part of the header that has become visible.
The following sample code reproduces the problem in 1.3.0 and 1.4.0 beta.
-----
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
public class TableHeaderBug extends JFrame {
private JTable jTable = new JTable();
private JScrollPane jscpScroll;
public TableHeaderBug() {
jTable.setModel(new MyTableModel());
jTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
jscpScroll = new JScrollPane(jTable);
// Manually set preferred size of header...
jTable.getTableHeader().setPreferredSize(
new Dimension(jTable.getSize().width, 40)
);
setContentPane(jscpScroll);
setSize(640, 480);
setVisible(true);
}
public static void main(String[] args) {
new TableHeaderBug();
}
}
class MyTableModel extends AbstractTableModel {
public int getRowCount() { return 100; }
public int getColumnCount() { return 8; }
public Object getValueAt(int r, int c) {
return new Integer((r+1)*(c+1));
}
public String getColumnName(int c) {
return "times by "+(c+1);
}
}
(Review ID: 126803)
======================================================================
Found in: J2SE 1.3.0 (build 1.3.0-C)
Also in: J2SE 1.4.0-beta (build 1.4.0-beta-b65)
This appears to be a problem with the rendering of JTable headers, such that
the header does not redraw properly when the table and header are horizontally
scrolled.
Steps:
1) Create a JTable and a simple model with several columns.
2) Set the JTable setAutoResizeMode to JTable.AUTO_RESIZE_OFF.
3) Add the JTable to a JScrollPane.
4) Manually set the preferred size of the JTable's header.
5) Place the whole lot in a JFrame and display it.
Now, if you resize the window so that some of the JTable's columns do not fit
you get a scroll bar as expected. Dragged the scroll bar to the right; the
header does not repaint the headers for the new columns that have become
visible (though the columns themselves look okay). The header display becomes
corrupt.
It appears as though the all pixels for the previously visible part of the
header have been shifted left okay, but the right-most fragment of the old
visible header region has been redrawn on the far right, rather than a new
rectangular section representing the part of the header that has become visible.
The following sample code reproduces the problem in 1.3.0 and 1.4.0 beta.
-----
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
public class TableHeaderBug extends JFrame {
private JTable jTable = new JTable();
private JScrollPane jscpScroll;
public TableHeaderBug() {
jTable.setModel(new MyTableModel());
jTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
jscpScroll = new JScrollPane(jTable);
// Manually set preferred size of header...
jTable.getTableHeader().setPreferredSize(
new Dimension(jTable.getSize().width, 40)
);
setContentPane(jscpScroll);
setSize(640, 480);
setVisible(true);
}
public static void main(String[] args) {
new TableHeaderBug();
}
}
class MyTableModel extends AbstractTableModel {
public int getRowCount() { return 100; }
public int getColumnCount() { return 8; }
public Object getValueAt(int r, int c) {
return new Integer((r+1)*(c+1));
}
public String getColumnName(int c) {
return "times by "+(c+1);
}
}
(Review ID: 126803)
======================================================================
- backported by
-
JDK-8084632 JTable header rendering problem (after setting preferred size)
- Resolved
-
JDK-2151268 JTable header rendering problem (after setting preferred size)
- Closed
-
JDK-2149318 JTable header rendering problem (after setting preferred size)
- Closed
- duplicates
-
JDK-6283018 JTable Header failed to renderer
- Closed
- relates to
-
JDK-6571861 JTable header can be made shorter than JTable itself
- Closed