-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.3.0
-
x86
-
windows_nt
Name: sl110371 Date: 06/15/2000
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
When JTable has resize off, does not fill the entrie scroll area width, and
requires up/down scrolling, the scrollpane begins to
display other parts of the screen in the scrollable area if the slider part of
the scrollbar is moved quickly. The following code demonstrates this.
Run the code DO NOT CLICK OR SELECT THE TABLE and scroll up and down quickly.
You should see parts of the top area of the window (the buttons) be displayed
in the scroll area. If you resize the window, this stops happening. If you
scroll slowly it stops. And if you click on the table, it stops.
Code:
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
public class TestTable extends JFrame {
TableModel dataModel = new AbstractTableModel() {
public int getColumnCount() { return 3; }
public int getRowCount() { return 50;}
public Object getValueAt(int row, int col) { return new Integer(row*col); }
};
JTable table = new JTable(dataModel);
JScrollPane scrollpane = new JScrollPane(table);
class WindowClose extends WindowAdapter {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
}
public TestTable(String title) {
super(title);
this.addWindowListener(new WindowClose());
table.setAutoResizeMode(table.AUTO_RESIZE_OFF);
}
public void init() {
JPanel p = new JPanel();
p.setLayout(new GridLayout(2,2));
p.add(new JButton("Hello"));
p.add(new JButton("Hello1"));
p.add(new JButton("Hello2"));
p.add(new JButton("Hello3"));
getContentPane().setLayout(new BorderLayout(0,5));
getContentPane().add(p, BorderLayout.NORTH);
getContentPane().add(scrollpane, BorderLayout.CENTER);
}
public static void main(String argv[]) {
TestTable t = new TestTable("Test Table");
t.init();
t.setSize(525,220);
t.setVisible(true);
}
}
(Review ID: 104703)
======================================================================
- duplicates
-
JDK-4320934 Incorrect JViewport background repaint when blit scroll mode is on.
-
- Closed
-