JavaFX How to scroll ScrollPane to have node in the middle of view port?
问题 I have to create timeline with line showing current time. I'm using AnchorPane with added line placed in ScrollPane. I need to simulate 1 day, scrollpane width is ( 2880px, every 60px is one hour). My limits are ( previous day 12hour, and next day 12 hour). Moving my line is working fine. All I need to do is to set line in the middle of view port and move content under it. For moving line i'm using this method: scrollPane.setHvalue( line.getStartX() - anchorPane.width); It is working "kind of