-
Bug
-
Resolution: Fixed
-
P4
-
1.2.2
-
beta
-
sparc
-
solaris_2.5
Name: sdC67446 Date: 02/10/99
The initial value of getRowHeight() is 0. The call of setRowHeight(0) throws
IllegalArgumentException - "FixedHeightLayoutCache only supports row
heights greater than 0". Also the call of getPathClosestTo(int x, int
y) causes ArithmeticException (dividing by zero).
The doc says:
--------------------------------------------------
public void setRowHeight(int rowHeight)
Sets the height of each cell. If rowHeight is less than or
equal to 0 this will throw an IllegalArgumentException.
Parameters:
rowHeight - the height of each cell, in pixels
Overrides:
setRowHeight in class AbstractLayoutCache
// from AbstractLayoutCache class //
public int getRowHeight()
Returns the height of each row. If the returned value is less
than or equal to 0 the height for each row is determined by the
renderer.
Parameters:
the - height of each cell, in pixels. Zero or negative
if the height of each row is determined by the tree cell
renderer
The test demonstrating the bug:
-----------------Test.java------------------------
import javax.swing.tree.*;
public class Test {
public static void main(String[] args) {
FixedHeightLayoutCache fhlc = new FixedHeightLayoutCache();
try {
System.out.println("fhlc.getRowHeight() = "+ fhlc.getRowHeight());
fhlc.setRowHeight(10);
System.out.println("fhlc.getRowHeight() = "+ fhlc.getRowHeight());
fhlc.setRowHeight(0);
System.out.println("fhlc.getRowHeight() = "+ fhlc.getRowHeight());
} catch (Exception e) {
System.out.println(e);
}
}
}
---------Output from the test---------------------
fhlc.getRowHeight() = 0
fhlc.getRowHeight() = 10
java.lang.IllegalArgumentException: FixedHeightLayoutCache only
supports row heights greater than 0
--------------------------------------------------
======================================================================