RFR: 8089009: TableView with CONSTRAINED_RESIZE_POLICY incorrectly displays a horizontal scroll bar.

Andy Goryachev angorya at openjdk.org
Wed Aug 10 20:01:53 UTC 2022


On Tue, 26 Jul 2022 00:28:59 GMT, Sai Pradeep Dandem <duke at openjdk.org> wrote:

>> modules/javafx.controls/src/main/java/javafx/scene/control/TableUtil.java line 226:
>> 
>>> 224:         }
>>> 225: 
>>> 226:         if (Math.abs(colWidth - tableWidth) > 0) {
>> 
>> Related to Andy's question, shouldn't this be `> EPSILON` (for some small value of EPSILON), since floating-point arithmetic isn't precise?
>
> @kevinrushforth We can consider EPSILON with value of `.0000001`. This value is already used in the same method for another bounds checking. Below is the part of the code where it is used..
> 
> // Check for zero. This happens when the distribution of the delta
> // finishes early due to a series of "fixed" entries at the end.
> // In this case, lowerBound == upperBound, for all subsequent terms.
> double newSize;
> if (Math.abs(totalLowerBound - totalUpperBound) < .0000001) {
>     newSize = lowerBound;
> } else {
>     double f = (target - totalLowerBound) / (totalUpperBound - totalLowerBound);
>     newSize = Math.round(lowerBound + f * (upperBound - lowerBound));
> }

I am also for declaring a constant


private static final double EPSILON = .0000001;


and using it in on lines 226 and  251.

-------------

PR: https://git.openjdk.org/jfx/pull/848


More information about the openjfx-dev mailing list