public void draw(Graphics2D g) {
	   if(!visible) return;
      
      int w = getWidth();
      int h = getHeight();

      //Color background = new Color(8, 145, 145);
      //Color background = new Color(35, 69, 102);
      Color background = new Color(22, 49, 79);
      Color foreground = Color.WHITE;
      RoundRectangle2D rect = new RoundRectangle2D.Float(0, 0, w, h, 10, 10);
      g.setColor(background);
      g.fill(rect);
      g.setStroke(Palette.STROKE1);
      g.setColor(foreground);
      g.draw(rect);

      //---------------------------------------------
      // Draw speedup
      //---------------------------------------------
      g.setFont(Palette.FONT_H1);
      if (pstate > 1) {
         g.drawString("x" + pstate, w/2 - 160, h - 10);
      }
      else if (pstate < -1) {
         g.drawString("x" + (pstate * -1), w/2 - 160, h - 10);
      }         
      
      //---------------------------------------------
      // Draw tick counter
      //---------------------------------------------
      g.setFont(Palette.FONT_BODY);
      String s = "tick: " + model.getPlayHead();
      int fw = g.getFontMetrics().stringWidth(s);
      g.drawString(s, w - fw - 10, h - 15);
      
      //---------------------------------------------
      // Draw the scrub bar
      //---------------------------------------------
      int bw = 250;
      int bh = 10;
      int bx = w/2 - bw/2;
      int by = h - bh - 10;
      g.setColor(Color.DARK_GRAY);
      g.fillRect(bx, by, bw, bh);

      SimStream stream = model.getStream();
      float scale = (float)bw / scrubMax;
      int min = (int)(stream.getMinIndex() * scale);
      int max = (int)(stream.getMaxIndex() * scale);

      g.setColor(Color.LIGHT_GRAY);
      g.fillRect(bx + min, by, max - min, bh);

      g.setColor(Color.GRAY);
      g.drawRect(bx, by, bw, bh);


      //---------------------------------------------
      // Move the play head
      //---------------------------------------------
      int index = model.getPlayHead();
      bx += (int)(index * scale);
      by += bh / 2;
      scrubButton.reshape(bx - 10, by - 10, 20, 20);

      for (Button button : buttons) {
         button.setDown(false);
      }

      if (target != null && target.containsTouch(touchX, touchY)) {
         target.setDown(true);
      }

      scrubButton.setDown(false);
      for (Button button : buttons) {
         button.draw(g);
      }
   }