75
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 Example with AdjustmentListener
Output:
Next Topicava JMenuItem and JMenu