1
votes

I have an JavaFX application with a gridpane containing several textfields. That gridpane is then added to a scrollPane.

Sometimes it happens that the cursor is not visible anymore and the user has to scroll manually. I want to implement some kind of auto scrolling.

I need to detect the following: 1) if mousepointer in one of the textfields is out of sight: how can this be controlled in javafx? 2) if I can check the previous step I can do setVValue to scroll down programmatically.

Thanks in advance

1

1 Answers

0
votes

I think you can use following method to scroll programmatically.

ScrollEvent.impl_scrollEvent(ScrollEvent.SCROLL, 0, scrollPixels, 0, 0, null, 0, null, 0, 0, 0, 0, 0, 0, false, false, false, false, false, false));

scrollPixels(use 5/10 value initially and then adjust as per your need) is the variable used as scroll unit.