0

How can I synchronisize two or more ScrollPanes in JavaFx-8? No matter which scrollbar is moved, every SrollPane should be updated like the other.

I found a solution here, but it works only in one way:

JavaFX ScrollPane - How to use one scrollbar to scroll 2 ScrollPanes?

testo
  • 1,052
  • 2
  • 8
  • 24

1 Answers1

1

Do bidirectional bindings for the vvalue and/or hvalue properties:

scrollPane1.hvalueProperty().bindBidirectional(scrollPane2.hvalueProperty());
scrollPane1.hvalueProperty().bindBidirectional(scrollPane3.hvalueProperty());

scrollPane1.vvalueProperty().bindBidirectional(scrollPane2.vvalueProperty());
scrollPane1.vvalueProperty().bindBidirectional(scrollPane3.vvalueProperty());
fabian
  • 80,457
  • 12
  • 86
  • 114