-
Bug
-
Resolution: Fixed
-
P4
-
1.3.0, 1.3.0_02
-
beta2
-
generic, x86, sparc
-
generic, solaris_7, windows_95, windows_nt
Name: yyT116575 Date: 12/14/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)
After variable row height has been set for a JTable (by calling the
JTable.setRowHeight(int, int) method), a bug in JTable.tableChanged
event handler prevents the number of rows displayed by the table to
increase when model fires TableStructureChanged or TableDataChanged
events; the number of rows can shrink if the new data contains less
rows; TableRowsInserted event is still handled correctly.
--- Test.java begins
import javax.swing.*;
import javax.swing.table.*;
public class Test
{
public static void main(String[] argv)
{
(new TestFrame()).show();
}
}
class TestFrame extends JFrame
{
public TestFrame()
{
this.setSize(800, 600);
TestModel tm = new TestModel();
tm.setData(new Object[] {"aaa 1", "aaa 2", "aaa 3"});
JTable jt = new JTable(tm);
this.getContentPane().add(new JScrollPane(jt));
// bug does not show when the following line is commented out
jt.setRowHeight(2, 20);
tm.setData(new Object[] {"bbb 1", "bbb 2", "bbb 3", "bbb 4", "bbb 5"});
}
}
class TestModel extends AbstractTableModel
{
Object[] data;
public void setData(Object[] d) {this.data = d; this.fireTableDataChanged();}
public int getRowCount() {return this.data.length;}
public int getColumnCount() {return 1;}
public Object getValueAt(int r, int c) {return this.data[r];}
}
-- Test.java ends
(Review ID: 113666)
======================================================================
- duplicates
-
JDK-4402032 Switching TableModels and resizing rows a problem
-
- Closed
-