Scroll Position in RichTextFX

844 views Asked by At

I'm using RichTextFX for a project, and want to add a Canvas to the background of the CodeArea in RichTextFX. I've done so, but I haven't been able to find a way to make it scroll with the CodeArea itself.

Is there a way to get the scroll position of the CodeArea programmatically so I can do this?

1

There are 1 answers

0
Thomas Weller On BEST ANSWER

While I haven't found good way of scrolling in percentage, the following is my current workaround, which works, if the scroll position correlates to some character position in the text:

int index = codeArea.getText().indexOf(textToFind);
codeArea.moveTo(index);
codeArea.selectRange(index, index);