1

I can get minX of viewport bounds by scrollView.getViewportBounds().getMinX(), but how can I set it?

I think a solution that can help me with this problem is: JavaFX How to scroll ScrollPane to have node in the middle of view port?

Community
  • 1
  • 1
kingkong
  • 1,537
  • 6
  • 27
  • 48

1 Answers1

1

You can't. getViewportBounds() returns a Bounds object which is immutable.

I'm guessing you want to restrict where the scrollpane can scroll to? Then you need to use the hmax, hmin, hvalue and vmax, vmin, vvalue properties of the ScrollPane.

zhujik
  • 6,514
  • 2
  • 36
  • 43