-
Bug
-
Resolution: Duplicate
-
P5
-
None
-
1.3.0
-
x86
-
windows_nt
Name: skT45625 Date: 05/09/2000
java version "1.3.0rc3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc3-Z)
Java HotSpot(TM) Client VM (build 1.3.0rc3-Z, mixed mode)
/*
Scrolling a JTable draws spurious objects to the right of the table
To reproduce, run this program. Then do the following:
1) Resize the window so that it is wider than the table. This will
produce a blank region to the right of the table.
2) Drag the vertical scroll bar up and down quickly. Spurious lines
will appear in the blank region. (In my application, these are
much worse. I get actual cells from the table, complete with column
headers.)
3) Leave the scrolling with spurious lines showing. Now click on any
unselected cell. This forces a redraw. The spurious lines vanish.
4) Drag the vertical scroll bar up and down quickly. The blank region
will now stay blank. No more srolling will result in spurious drawing.
5) To bring the bug back, shrink the window small enough to produce
a horizontal scroll bar.
6) Return to step 1, and the bug will reappear.
This occurs under JDK 1.3. It also shows up under JDK 1.2.2, when
the scrollbar's viewport has the EnableWindowBlit property set to
true.
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
public class TableScrollBug extends JPanel
{
public static void main(String[] argv)
{
JFrame frame = new JFrame("JTable Cell Renderer Bug");
frame.setSize(new java.awt.Dimension(600,300));
frame.getContentPane().add(new TableScrollBug());
WindowListener wl = new WindowAdapter()
{
public void windowClosing(WindowEvent evt) { System.exit(0); }
};
frame.addWindowListener(wl);
frame.show();
}
TableScrollBug()
{
super(new BorderLayout());
TableModel mdl = new BugModel();
JTable tbl = new JTable(mdl);
tbl.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELE
CTION);
tbl.setCellSelectionEnabled(true);
tbl.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
JScrollPane scr = new JScrollPane(tbl);
// under JDK 1.2.2, this line will create the same problem:
// scr.getViewport().putClientProperty("EnableWindowBlit", Boolean.TRUE);
add(scr, BorderLayout.CENTER);
}
public class BugModel extends AbstractTableModel
{
public int getRowCount() { return 500; }
public int getColumnCount() { return 10; }
public Object getValueAt(int row, int col) { return "R" + row + " C" + col;
}
}
}
(Review ID: 104533)
======================================================================
- duplicates
-
JDK-4320934 Incorrect JViewport background repaint when blit scroll mode is on.
-
- Closed
-