gpt4 book ai didi

JavaFX - 如何在单击按钮时以编程方式滚动 ScrollPane?

转载 作者:行者123 更新时间:2023-12-02 09:08:56 26 4
gpt4 key购买 nike

我想知道是否有任何“简单”的方法可以将垂直滚动条设置为在按下按钮时或实际上在发生任何事件时“滚动”特定量。

例如,我有一个具有侧边栏的应用程序,侧边栏上的选项之一是“设置”。设置有子项目,我想添加单击其中一个子项目的功能,它将打开“设置”页面并自动向下滚动到该子项目所在页面上的特定点。

最佳答案

要以编程方式垂直滚动 ScrollPane,只需操作 vvalue属性(property)。这是该属性的文档:

The current vertical scroll position of the ScrollPane. This value may be set by the application to scroll the view programatically. The ScrollPane will update this value whenever the viewport is scrolled or panned by the user. This value must always be within the range of vmin to vmax. When vvalue equals vmin, the contained node is positioned so that its layoutBounds minY is visible. When vvalue equals vmax, the contained node is positioned so that its layoutBounds maxY is visible. When vvalue is between vmin and vmax, the contained node is positioned proportionally between layoutBounds minY and layoutBounds maxY.

关于JavaFX - 如何在单击按钮时以编程方式滚动 ScrollPane?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59566201/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com