-
Enhancement
-
Resolution: Incomplete
-
P4
-
None
-
8u60
-
x86_64
-
windows_7
A DESCRIPTION OF THE REQUEST :
Method setRowHeight(int row, int rowHeight) in JTable does not check if parameter rowHeight is equal to the value returned by getRowHeight(int row) before executing and calling its resizeAndRepaint() method.
JUSTIFICATION :
When method setRowHeight(int, int) is called from a TableCellRenderer, this forces the table to call repaint() and infinite number of times and consuming large, unnecessary amounts of CPU.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Method setRowHeight(int row, int rowHeight) would not execute anything if getRowHeight(int row) is equal to parameter rowHeight.
ACTUAL -
Method setRowHeight(int row, int rowHeight) executes regardless of the value returned by getRowHeight(int row). This essentially prevents method setRowHeight(int row, int rowHeight) from being called in a TableCellRenderer without serious performance issues.
CUSTOMER SUBMITTED WORKAROUND :
Callers should ensure their desired row height does not equal the value returned by getRowHeight(int row) before calling setRowHeight(int row, int rowHeight).
JTable can also be extended and method setRowHeight can be overridden as follows:
@Override
public void setRowHeight(int row, int rowHeight)
{
if(super.getRowHeight(row) != rowHeight)
{
super.setRowHeight(row, rowHeight);
}
}
Method setRowHeight(int row, int rowHeight) in JTable does not check if parameter rowHeight is equal to the value returned by getRowHeight(int row) before executing and calling its resizeAndRepaint() method.
JUSTIFICATION :
When method setRowHeight(int, int) is called from a TableCellRenderer, this forces the table to call repaint() and infinite number of times and consuming large, unnecessary amounts of CPU.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Method setRowHeight(int row, int rowHeight) would not execute anything if getRowHeight(int row) is equal to parameter rowHeight.
ACTUAL -
Method setRowHeight(int row, int rowHeight) executes regardless of the value returned by getRowHeight(int row). This essentially prevents method setRowHeight(int row, int rowHeight) from being called in a TableCellRenderer without serious performance issues.
CUSTOMER SUBMITTED WORKAROUND :
Callers should ensure their desired row height does not equal the value returned by getRowHeight(int row) before calling setRowHeight(int row, int rowHeight).
JTable can also be extended and method setRowHeight can be overridden as follows:
@Override
public void setRowHeight(int row, int rowHeight)
{
if(super.getRowHeight(row) != rowHeight)
{
super.setRowHeight(row, rowHeight);
}
}