98
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:
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:
- setMin()
- setMax()
- 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:
Next TopicJavaFX FileChooser