Scrollbar

A scrollbar is represented by a "slider" widget. The characteristics of it are specified by integer values which are being set at the time of scrollbar construction. Both the types of Sliders are available i.e. horizontal and vertical.

Scrollbar

A scrollbar is represented by a "slider" widget. The characteristics of it are specified by integer values which are being set at the time of scrollbar construction. Both the types of Sliders are available i.e. horizontal and vertical.

Scrollbar

Scrollbar

     

A scrollbar is represented by a "slider" widget. The characteristics of it are specified by integer values which are being set at the time of scrollbar construction. Both the types of Sliders are available i.e. horizontal and vertical

The example below shows the code for the scrollbar construction. The subtraction of scrollbar width from the maximum setting gives the maximum value of the Scrollbar. In the program code, '0' is the <<<<<<< scrollbar.shtml initial value of the scrollbar, '8' is the width of the scrollbar.

 

 

======= initial value of the scrollbar, '8' is the width of the scrollbar.

>>>>>>> 1.2
import java.awt.*; 
import java.applet.Applet; 
 
public class ScrollbarDemo extends Applet { 
  public void init() { 
  Scrollbar sb =  new Scrollbar
  (Scrollbar.VERTICAL, 
08, -100100); 
  add(sb); 
  


Here is the output:
 

C:\newprgrm>javac ScrollbarDemo.java

C:\newprgrm>appletviewer ScrollbarDemo.html

 

Download this example.