Scroll Bar:
A document window in a text processor commonly has two scroll bars. The vertical scrollbar to scroll up and down. A horizontal scroll bar same scrolls the document left and right. A scroll bar therefore denotes the associative position of the visible contents in relation to the overall document. This is one classical use of scroll bars. A scroll bar could also be used as a controller to specify a value from a provided interval.
The Scroll bar gives two constants to denote orientation
public static final HORIZONTAL
public static final VERTICAL
Three constructors gives several ways to create scroll bars:
Scrollbar( )
Scrollbar(int orientation)
Scrollbar(int orientation, int value, int visible, int minimum, int maximum)
The visible argument determines the visible width of the slider. Arguments minimum and maximum specify the interval represented through the scroll bar.
The Scroll bars define an assortment of accessor methods.
// Illustrating Scroll bar
import java.awt.*;
import java.applet.*;
public class ScrollbarApplet extends Applet
{
public void init( )
{
Scrollbar bar = new Scrollbar( );
Scrollbar(Scrollbar.HORIZONTAL,0,10,-50,100);
add(bar);
}
}