JavaFX自动向下滚动滚动窗格 [英] JavaFX auto-scroll down scrollpane

查看:909
本文介绍了JavaFX自动向下滚动滚动窗格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当内容的高度增加时,有没有办法自动向下滚动ScrollPane控件?
例如,我在屏幕底部(ScrollPane内部)有一个TitledPane,当我展开它时,我希望ScrollPane向下滚动,这样我就能看到TitledPane的全部内容。

Is there any way of auto scroll down a ScrollPane control when it content's height increases ? For example, I have a TitledPane on the bottom of the screen (inside a ScrollPane) and when I expand it I would like the ScrollPane to scroll down so I can see the entire content of the TitledPane.

推荐答案

你可以通过组合 titledPane.localToScene()和<$来实现这种行为c $ c> scrollPane.setVvalue()

第一个是获取titledPane的坐标,第二个是设置scrollPane的垂直条位置。请注意,它的范围介于0 - 1之间。

The first is to get titledPane's coordinates while the second is to set scrollPane's vertical bar position. Note that it's range is between 0 - 1.

这篇关于JavaFX自动向下滚动滚动窗格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆