Javatpoint Logo
Javatpoint Logo

JavaFX ScrollBar

JavaFX Scroll Bar is used to provide a scroll bar to the user so that the user can scroll down the application pages. It can be created by instantiating javafx.scene.control.ScrollBar class.

The following code implements scrollbar into our application.

Output:


JavaFX ScrollBar

Setting values and orientation

As we see in the modern days application, the scrollbar is shown horizontally as well as vertically. In JavaFX, we can set any of the orientation for the scrollbar. setOrientation() and passing the Orientation.VERTICAL property into the method as an argument.

ScrollBar class also provide three methods named as:

  1. setMin()
  2. setMax()
  3. setValue()

these methods are used to set the minimum, maximum and current value of the scrollbar. It decides span of the scrollbar. The following code shows the implementation.

Output:


JavaFX ScrollBar 1
Next TopicJavaFX FileChooser




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA