How to sync scrollbars in JavaFX?

I have two TextAreas in my application and I want to make the scroll slides sync when I move one of the scroll bars. But I cannot find a way to do this in JavaFX 2.2.

+3


source to share


1 answer


This worked for me:

TextArea ta1 = new TextArea(), ta2 = new TextArea();
ta1.scrollTopProperty().bindBidirectional(ta2.scrollTopProperty());

      



In general, you can apply the lookupAll (String) operation on a TextArea to find the scrollbar inside the TextArea and bind their values ​​bi-directionally.

+7


source







All Articles