[英]JavaFX TableView ScrollBar value explanation
Could anyone explain what vertical scroll bar value means? 谁能解释垂直滚动条值的含义? For example, there is a table with 100 rows.
例如,有一个包含100行的表。 View port can show only 10 rows.
视口只能显示10行。 For example rows 26-35 are shown.
例如,示出了行26-35。 What will be value of scroll bar and how it is calculated?
滚动条的值是多少,如何计算?
Assuming all rows are the same height: 假设所有行的高度相同:
A scroll bar has a min
, max
, and value
. 滚动条具有
min
, max
和value
。 If your viewport shows 10 rows and the table has 100 items, then it can be scrolled vertically a total of 90 rows (at one end, showing rows 1-10, and at the other, showing rows 91-100). 如果视口显示10行,并且该表包含100个项目,则可以垂直滚动总共90行(一端显示1-10行,另一端显示91-100行)。 If it shows 26-35 then it has scrolled 25 rows, so you will have
如果显示26-35,则它已滚动25行,因此您将拥有
(value - min) / (max - min) = 25/90
or 要么
value = min + 25*(max - min) / 90
The default min
and max
are 0
and 1
, respectively, so with those defaults this would be 默认的
min
和max
分别为0
和1
,因此使用这些默认值将是
value = 25 /90 = 0.277778
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.