// {$R ColorTest.JFM}

import java.awt.*;

// Class ColorTest
public class ColorTest extends Frame
{
    final int MenuBarHeight = 0;
    boolean fForm_Create;

    // Component Declaration
    public Panel Panel1;
    public Label Label1;
    public Label Label2;
    public Label Label3;
    public Label RedLabel;
    public Label GreenLabel;
    public Label BlueLabel;
    public Scrollbar ScrollBar1;
    public Scrollbar ScrollBar2;
    public Scrollbar ScrollBar3;
    // End of Component Declaration

    // Constructor
    public ColorTest()
    {
        // Frame Initialization
        setForeground(Color.black);
        setBackground(Color.lightGray);
        setFont(new Font("Dialog",Font.BOLD,12));
        setTitle("ColorTest");
        setLayout(null);
        // End of Frame Initialization

        // Component Initialization
        Panel1 = new Panel();
        Panel1.setLayout(null);
        Panel1.setForeground(Color.black);
        Panel1.setBackground(Color.black);
        Panel1.setFont(new Font("Dialog",Font.BOLD,12));
        Label1 = new Label("Red :",Label.LEFT);
        Label1.setFont(new Font("Dialog",Font.BOLD,12));
        Label2 = new Label("Green :",Label.LEFT);
        Label2.setFont(new Font("Dialog",Font.BOLD,12));
        Label3 = new Label("Blue :",Label.LEFT);
        Label3.setFont(new Font("Dialog",Font.BOLD,12));
        RedLabel = new Label("0",Label.LEFT);
        RedLabel.setFont(new Font("Dialog",Font.BOLD,12));
        GreenLabel = new Label("0",Label.LEFT);
        GreenLabel.setFont(new Font("Dialog",Font.BOLD,12));
        BlueLabel = new Label("0",Label.LEFT);
        BlueLabel.setFont(new Font("Dialog",Font.BOLD,12));
        ScrollBar1 = new Scrollbar(Scrollbar.HORIZONTAL);
        ScrollBar1.setValues(0,22,0,255);
        ScrollBar1.setBackground(Color.lightGray);
        ScrollBar2 = new Scrollbar(Scrollbar.HORIZONTAL);
        ScrollBar2.setValues(0,22,0,255);
        ScrollBar2.setBackground(Color.lightGray);
        ScrollBar3 = new Scrollbar(Scrollbar.HORIZONTAL);
        ScrollBar3.setValues(0,22,0,255);
        ScrollBar3.setBackground(Color.lightGray);
        // End of Component Initialization

        // Add()s
        add(ScrollBar3);
        add(ScrollBar2);
        add(ScrollBar1);
        add(BlueLabel);
        add(GreenLabel);
        add(RedLabel);
        add(Label3);
        add(Label2);
        add(Label1);
        add(Panel1);
        // End of Add()s

        fForm_Create = true;
    }

    public void InitialPositionSet()
    {
        // InitialPositionSet()
        reshape(191,107,283,229);
        Panel1.reshape(11,29+MenuBarHeight,262,95);
        Label1.reshape(26,143+MenuBarHeight,48,16);
        Label2.reshape(13,167+MenuBarHeight,64,16);
        Label3.reshape(22,192+MenuBarHeight,54,16);
        RedLabel.reshape(76,143+MenuBarHeight,55,16);
        GreenLabel.reshape(77,168+MenuBarHeight,50,16);
        BlueLabel.reshape(77,194+MenuBarHeight,54,16);
        ScrollBar1.reshape(142,141+MenuBarHeight,121,16);
        ScrollBar2.reshape(142,168+MenuBarHeight,121,16);
        ScrollBar3.reshape(142,195+MenuBarHeight,121,16);
        // End of InitialPositionSet()

        fForm_Create = false;
    }

    public boolean handleEvent(Event evt)
    {
        // handleEvent()
        if (evt.id == Event.WINDOW_DESTROY && evt.target == this) ColorTest_WindowDestroy(evt.target);
        else if (evt.id == Event.SCROLL_ABSOLUTE && evt.target == ScrollBar1) ScrollBar1_ScrollAbsolute(evt.target, ((Scrollbar)(evt.target)).getValue());
        else if (evt.id == Event.SCROLL_LINE_DOWN && evt.target == ScrollBar1) ScrollBar1_ScrollAbsolute(evt.target, ((Scrollbar)(evt.target)).getValue());
        else if (evt.id == Event.SCROLL_LINE_UP && evt.target == ScrollBar1) ScrollBar1_ScrollAbsolute(evt.target, ((Scrollbar)(evt.target)).getValue());
        else if (evt.id == Event.SCROLL_PAGE_DOWN && evt.target == ScrollBar1) ScrollBar1_ScrollAbsolute(evt.target, ((Scrollbar)(evt.target)).getValue());
        else if (evt.id == Event.SCROLL_PAGE_UP && evt.target == ScrollBar1) ScrollBar1_ScrollAbsolute(evt.target, ((Scrollbar)(evt.target)).getValue());
        else if (evt.id == Event.SCROLL_ABSOLUTE && evt.target == ScrollBar2) ScrollBar2_ScrollAbsolute(evt.target, ((Scrollbar)(evt.target)).getValue());
        else if (evt.id == Event.SCROLL_LINE_DOWN && evt.target == ScrollBar2) ScrollBar2_ScrollAbsolute(evt.target, ((Scrollbar)(evt.target)).getValue());
        else if (evt.id == Event.SCROLL_LINE_UP && evt.target == ScrollBar2) ScrollBar2_ScrollAbsolute(evt.target, ((Scrollbar)(evt.target)).getValue());
        else if (evt.id == Event.SCROLL_PAGE_DOWN && evt.target == ScrollBar2) ScrollBar2_ScrollAbsolute(evt.target, ((Scrollbar)(evt.target)).getValue());
        else if (evt.id == Event.SCROLL_PAGE_UP && evt.target == ScrollBar2) ScrollBar2_ScrollAbsolute(evt.target, ((Scrollbar)(evt.target)).getValue());
        else if (evt.id == Event.SCROLL_ABSOLUTE && evt.target == ScrollBar3) ScrollBar3_ScrollAbsolute(evt.target, ((Scrollbar)(evt.target)).getValue());
        else if (evt.id == Event.SCROLL_LINE_DOWN && evt.target == ScrollBar3) ScrollBar3_ScrollAbsolute(evt.target, ((Scrollbar)(evt.target)).getValue());
        else if (evt.id == Event.SCROLL_LINE_UP && evt.target == ScrollBar3) ScrollBar3_ScrollAbsolute(evt.target, ((Scrollbar)(evt.target)).getValue());
        else if (evt.id == Event.SCROLL_PAGE_DOWN && evt.target == ScrollBar3) ScrollBar3_ScrollAbsolute(evt.target, ((Scrollbar)(evt.target)).getValue());
        else if (evt.id == Event.SCROLL_PAGE_UP && evt.target == ScrollBar3) ScrollBar3_ScrollAbsolute(evt.target, ((Scrollbar)(evt.target)).getValue());
        // End of handleEvent()

        return super.handleEvent(evt);
    }

    public void paint(Graphics g)
    {
        // paint()
        // End of paint()
        if (fForm_Create) InitialPositionSet();
    }

   // main()
   public static void main(String args[])
   {
       ColorTest ColorTest = new ColorTest();
       ColorTest.show();
   } // End of main()

    // Event Handling Routines
    public void ColorTest_WindowDestroy(Object target)
    {
        System.exit(0);
    }

    public void ScrollBar1_ScrollAbsolute(Object target, int value)
    {
        RedLabel.setText(""+ScrollBar1.getValue());
        Panel1.setBackground(new Color(ScrollBar1.getValue(), ScrollBar2.getValue(), ScrollBar3.getValue()));
        Panel1.repaint();
    }

    public void ScrollBar2_ScrollAbsolute(Object target, int value)
    {
        GreenLabel.setText(""+ScrollBar2.getValue());
        Panel1.setBackground(new Color(ScrollBar1.getValue(), ScrollBar2.getValue(), ScrollBar3.getValue()));
        Panel1.repaint();
    }

    public void ScrollBar3_ScrollAbsolute(Object target, int value)
    {
        BlueLabel.setText(""+ScrollBar3.getValue());
        Panel1.setBackground(new Color(ScrollBar1.getValue(), ScrollBar2.getValue(), ScrollBar3.getValue()));
        Panel1.repaint();
    }

    // End of Event Handling Routines

} // End of Class ColorTest

