Scrollt.java

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

class Scrollt extends Applet {
    Scrollbar h1,h2,h3;
    Color c;
    TextField tfr,tfg,tfb;
    public void init() {
        Panel p=new Panel();
        p.setLayout(new GridLayout(1,6));
        p.add(new Label("R="));
        p.add(tfr=new TextField("0"));
        p.add(new Label("G="));
        p.add(tfg=new TextField("0"));
        p.add(new Label("B="));
        p.add(tfb=new TextField("0"));
        setLayout(new BorderLayout());
        add("West",h1=new Scrollbar(Scrollbar.VERTICAL,0,0,0,255));
        add("South",h2=new Scrollbar(Scrollbar.HORIZONTAL,0,0,0,255));
        add("East",h3=new Scrollbar(Scrollbar.VERTICAL,0,0,0,255));
        add("North",p);
    }

    public void paint(Graphics g) {
        c=new Color(h1.getValue(),h2.getValue(),h3.getValue());
        g.setColor(c);
        g.fillRect(0,0,160,160);
    }

    public boolean action(Event e,Object o) {
        h1.setValue(Integer.parseInt(tfr.getText()));
        h2.setValue(Integer.parseInt(tfg.getText()));
        h3.setValue(Integer.parseInt(tfb.getText()));
        repaint();
        return true;
    }

    public boolean handleEvent(Event e) {
        tfr.setText(String.valueOf(h1.getValue()));
        tfg.setText(String.valueOf(h2.getValue()));
        tfb.setText(String.valueOf(h3.getValue()));
        repaint();
        return true;
    }
}