Javatpoint Logo
Javatpoint Logo

Java JScrollBar

The object of JScrollbar class is used to add horizontal and vertical scrollbar. It is an implementation of a scrollbar. It inherits JComponent class.

JScrollBar class declaration

Let's see the declaration for javax.swing.JScrollBar class.

Commonly used Constructors:

Constructor Description
JScrollBar() Creates a vertical scrollbar with the initial values.
JScrollBar(int orientation) Creates a scrollbar with the specified orientation and the initial values.
JScrollBar(int orientation, int value, int extent, int min, int max) Creates a scrollbar with the specified orientation, value, extent, minimum, and maximum.

Java JScrollBar Example

Output:

JAVA Jscrollbar 1

Java JScrollBar Example with AdjustmentListener

Output:

JAVA Jscrollbar 2



Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA