//
import java.awt.*;

public class TestSlider2 extends BufferedApplet
{
   Slider slider;

   int w = 0, h = 0;

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

         slider = new Slider(100,100,100,15);
         slider.label = "my second slider";
      }

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

      slider.render(g);

      g.setColor(Color.blue);
      int size = 50 + (int)(50 * slider.getValue());
      g.fillRect(150 - size/2, 200 - size/2, size, size);
   }

   public boolean mouseDown(Event e, int x, int y) {
      slider.down(x, y);
      damage = true;
      return true;
   }

   public boolean mouseDrag(Event e, int x, int y) {
      slider.drag(x, y);
      damage = true;
      return true;
   }

   public boolean mouseUp(Event e, int x, int y) {
      slider.up(x, y);
      damage = true;
      return true;
   }
}