Attempting to synchronize the scroll position of two CodeAreas is not possible because the estimatedScrollYPosition is unstable. During a scroll operation the reported value flickers to unreasonable values.
For example, if I print estimatedScrollYPosition.value() in a listener while I drag the scrollbar down, I see values like this:
Initial values reported from listener before I grab the scroll bar:
-4.375 (this seems odd)
0.0 (this is expected)
Then as I drag:
5.6
11.2
16.8
... all good for little bit... then...
117.6
174.8 (WRONG!)
117.6 (interesting, back to the SAME value as before, not greater than 117.6)
...
130.1
244.6 (WRONG! )
130.1
...
173.6
230.9 (WRONG!)
173.6
...
So when binding the value to another scroll pane we see those mistakes visually. Interestingly, the original pane that is being scrolled does not flicker, unless the binding is bidirectional.
Attempting to synchronize the scroll position of two CodeAreas is not possible because the estimatedScrollYPosition is unstable. During a scroll operation the reported value flickers to unreasonable values.
For example, if I print estimatedScrollYPosition.value() in a listener while I drag the scrollbar down, I see values like this:
Initial values reported from listener before I grab the scroll bar:
-4.375 (this seems odd)
0.0 (this is expected)
Then as I drag:
5.6
11.2
16.8
... all good for little bit... then...
117.6
174.8 (WRONG!)
117.6 (interesting, back to the SAME value as before, not greater than 117.6)
...
130.1
244.6 (WRONG! )
130.1
...
173.6
230.9 (WRONG!)
173.6
...
So when binding the value to another scroll pane we see those mistakes visually. Interestingly, the original pane that is being scrolled does not flicker, unless the binding is bidirectional.