Scrollbar
A Scrollbar is a "slider" widget containing an integer value. The range of the integer value is set during Scrollbar construction. Both horizontal and
vertical sliders are available.
Corresponding source code:
import java.applet.*;
import java.awt.*;
public class ScrollbarWidget extends Applet {
public void init() {
// using a GridLayout ensures Scrollbar fills applet
setLayout(new GridLayout(1,1));
Scrollbar sb;
sb = new Scrollbar(Scrollbar.HORIZONTAL,
0, // initial value is 0
10, // slide control size
-100,100); // range is [-100,100]
add(sb);
}
}
Methods:
- public Scrollbar(int orientation)
Constructs a Scrollbar with the specified orientation either Scrollbar.HORIZONTAL or Scrollbar.VERTICAL.
- public Scrollbar(int orientation, int value, int visible,
int minimum, int maximum)
Constructs a Scrollbar with the specified orientation, initial value (where the "thumb" is positioned), visible page size, and minumum and maximum range values. The visible argument is 0 when you just want a slider control not a window scroller.
|