Search Here

Java program to create ScrollBar


/* ScrollBar */

import java.applet.*;
import java.awt.*;

/*
    <applet code=scroll_bar height=300 width=400>
    </applet>
*/

public class scroll_bar extends Applet 
{
    // style(0=Horizontal, 1=Vertical),initialvalue,thumbsize,min,max)
    Scrollbar s1 = new Scrollbar(0,1,20,1,275);
    Scrollbar s2 = new Scrollbar(1,1,20,1,275);
    Panel p1 = new Panel();
    Panel p2 = new Panel();
  
    public void init()
    {
        p1.setLayout(new GridLayout(1,1));
        p2.setLayout(new GridLayout(1,1));      
        setLayout(new BorderLayout());
        p1.add(s1);
        p2.add(s2);
        add(p1,"South");
        add(p2,"East");
    }
}

No comments:

Post a Comment