同时滚动2列表视图
在我的JavaFX
项目中,我使用2个TextFlows
来显示一些文本。 我使用了ScrollPanes
vvalueProperty
,它持有TextFlows
以同时滚动两个TextFlow
scrolPane1.vvalueProperty().bindBidirectional(scrolPane2.vvalueProperty());
但由于TextFlow
仅支持Java 8
,我试图用ListView
替换它们。 如何同时滚动2个ListViews
? 由于ListView
包含内部ScrollPane
,因此使用TextFlow的方法在此处不起作用。
我只想在同一时间滚动2个ListViews
。
尝试类似的东西
Platform.runLater(new Runnable() { @Override public void run() { Node n = listView1.lookup(".scroll-bar"); if (n instanceof ScrollBar) { final ScrollBar bar = (ScrollBar) n; if (bar.getOrientation().equals(Orientation.VERTICAL)) { // get the second scrollbar of another listview and bind values of them } } } });