如何在JavaFx-8中同步两个或多个ScrollPanes?无论移动哪个滚动条,每个SrollPane都应该像另一个一样进行更新。
我在这里找到了一个解决方案,但它只能以一种方式运行:
JavaFX ScrollPane - How to use one scrollbar to scroll 2 ScrollPanes?
答案 0 :(得分:1)
对vvalue
和/或hvalue
属性进行双向绑定:
scrollPane1.hvalueProperty().bindBidirectional(scrollPane2.hvalueProperty());
scrollPane1.hvalueProperty().bindBidirectional(scrollPane3.hvalueProperty());
scrollPane1.vvalueProperty().bindBidirectional(scrollPane2.vvalueProperty());
scrollPane1.vvalueProperty().bindBidirectional(scrollPane3.vvalueProperty());