//
import java.awt.*;

public class TestSlider3 extends BufferedApplet
{
   String label[] = {"red  ","green","blue "};
   Slider slider[] = new Slider[label.length];
   Color color = new Color(0,0,0);

/*
   int X[] = new int[20];
   int Y[] = new int[20];

   Polygon p = new Polygon(X, Y, nPoints);

   boolean hit = p.contains(x, y);
*/

   int w = 0, h = 0;

   public void render(Graphics g) {
      if (w == 0) {
         w = bounds().width;
         h = bounds().height;

         for (int i = 0 ; i < slider.length ; i++) {
            slider[i] = new Slider(100,100 + 15 * i,100,15);
            slider[i].label = label[i];
         }
      }

      g.setColor(Color.white);
      g.fillRect(0,0,w,h);

      g.setColor(Color.black);
      for (int i = 0 ; i < slider.length ; i++) {
         slider[i].render(g);
         g.drawString("" + slider[i].getValue(), slider[i].x + slider[i].width + 3, slider[i].y + 12);
      }


      g.setColor(new Color((float)slider[0].getValue(),
                           (float)slider[1].getValue(),
                           (float)slider[2].getValue()));

      g.fillRect(100, 150, 100, 100);
   }

   public boolean mouseDown(Event e, int x, int y) {
      for (int i = 0 ; i < slider.length ; i++)
         slider[i].down(x, y);
      damage = true;
      return true;
   }

   public boolean mouseDrag(Event e, int x, int y) {
      for (int i = 0 ; i < slider.length ; i++)
         slider[i].drag(x, y);
      damage = true;
      return true;
   }

   public boolean mouseUp(Event e, int x, int y) {
      for (int i = 0 ; i < slider.length ; i++)
         slider[i].up(x, y);
      damage = true;
      return true;
   }
}