private void init()
  {
    this.setLayout(new BorderLayout());
    JPanel buttonPanel = new JPanel();
    JPanel infoPanel = new JPanel();
    
    // set up info panel
    directoryLabel = new JLabel("Directory: ");
    FrameSequencer frameSequencer = videoHandler.getFrameSequencer();
    String dir = frameSequencer.getDirectory();
    dirTextField = new JTextField(dir,Math.max(20,dir.length()));
    dirTextField.setToolTipText("Directory to write the movie frames to");
    dirTextField.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        FrameSequencer frameSequencer = videoHandler.getFrameSequencer();
        String dir = dirTextField.getText();
        frameSequencer.setDirectory(dir);
      }
    });
    infoPanel.add(directoryLabel);
    infoPanel.add(dirTextField);
    frameRateLabel = new JLabel("Frames per Second: ");
    infoPanel.add(frameRateLabel);

    String[] rates = {"16","24","30"};
    frameRateList = new JList<String>(rates);
    JScrollPane scrollPane = new JScrollPane(frameRateList);
    frameRateList.setSelectedIndex(0);
    frameRateList.setVisibleRowCount(1);
    frameRateList.setToolTipText("The number of frames per second in the movie");
    frameRateList.addListSelectionListener(new ListSelectionListener() {
      public void valueChanged(ListSelectionEvent e) {
        String rate = (String) frameRateList.getSelectedValue();
        videoHandler.setFramesPerSecond(Integer.parseInt(rate));
      }
    });
    infoPanel.add(scrollPane);
    
    // add help button
    helpButton = new JButton("Help");
    helpButton.setToolTipText("Click here to see help");
    helpButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        showHelp();
      }
    });
    infoPanel.add(helpButton);
    //infoPanel.add(frameRateTextField);
    
    // set up button panel
    
    // create the capture screen button
    captureScreenButton = new JButton("Capture Screen");
    captureScreenButton.setToolTipText("Click here to capture the"+
                                       " screen image and show it below");
    buttonPanel.add(captureScreenButton);
    captureScreenButton.addActionListener(new ActionListener() {
      public void actionPerformed (ActionEvent e) {
        if (videoHandler != null && regionHandler != null)
          try {
          regionHandler.setBackgroundImage(videoHandler.captureScreen());
          pickRegionButton.setEnabled(true);
          repaint();
        } catch (Exception ex) {
        }
      }
    });
    
    // create the pick region button
    pickRegionButton = new JButton("Pick Region");
    pickRegionButton.setToolTipText("Click here to pick a region to capture."+
                               "  Then click on the top left corner and "+ 
                          "drag the cursor to the bottom right of the region");
    pickRegionButton.setEnabled(false);
    buttonPanel.add(pickRegionButton);
    pickRegionButton.addActionListener(new ActionListener() {
      public void actionPerformed (ActionEvent e) {
        if (regionHandler != null)
        {
           regionHandler.clearShapes();
           startButton.setEnabled(true);
           //pictureButton.setEnabled(true);
        }
      }
    });
    
//    JLabel label = new JLabel("Number of Seconds to Capture: ");
//    secField = new JTextField("3",3);
//    add(label);
//    add(secField);
    
    // create the start capture button
    startButton = new JButton("Start Capture");
    startButton.setToolTipText("Click here to start the video capture");
    startButton.setEnabled(false);
    buttonPanel.add(startButton);
    startButton.addActionListener(new ActionListener() {
      public void actionPerformed (ActionEvent e) {
        if (videoHandler != null)
        {
          java.awt.Rectangle region = videoHandler.getRegion();
          FrameSequencer frameSequencer = videoHandler.getFrameSequencer();
          int framesPerSec = videoHandler.getFramesPerSecond();
          t = new Thread(new StartMovieCapture(frameSequencer,
                                                      framesPerSec,
                                                      region));
          startButton.setEnabled(false);
          stopButton.setEnabled(true);
          t.start();
        }
      }
    });
    
    // create the stop capture button
    stopButton = new JButton("Stop Capture");
    stopButton.setToolTipText("Click here to stop the video capture");
    stopButton.setEnabled(false);
    buttonPanel.add(stopButton);
    stopButton.addActionListener(new ActionListener() {
      @SuppressWarnings("deprecation")
	public void actionPerformed (ActionEvent e) {
        if (videoHandler != null && t != null)
        {
          t.stop();
          t = null;
          startButton.setEnabled(true);
          stopButton.setEnabled(false);
          playButton.setEnabled(true);
        }
      }
    });
    
    // create the take picture button
//    pictureButton = new JButton("Take Picture");
//    pictureButton.setToolTipText("Click here to take a picture");
//    pictureButton.setEnabled(false);
//    buttonPanel.add(pictureButton);
//    pictureButton.addActionListener(new ActionListener() {
//      public void actionPerformed (ActionEvent e) {
//        BufferedImage image = null;
//        if (videoHandler != null)
//        {
//          java.awt.Rectangle region = videoHandler.getRegion();
//          if (region != null)
//          {
//            FrameSequencer frameSequencer = videoHandler.getFrameSequencer();
//            try {
//              image = new Robot().createScreenCapture(region);
//            } catch (Exception ex) {
//              ex.printStackTrace();
//              System.out.println("caught exception while taking a picture");
//            }
//            Picture p = new Picture(image);
//            frameSequencer.addFrame(p);
//          }
//        }
//      }
//    });
    
    // create the play movie button
    playButton = new JButton("Play Movie");
    playButton.setToolTipText("Click here to play the captured video");
    playButton.setEnabled(false);
    buttonPanel.add(playButton);
    playButton.addActionListener(new ActionListener() {
      public void actionPerformed (ActionEvent e) {
        if (videoHandler != null)
          videoHandler.playMovie();
      }
    });
    
    this.add(infoPanel,BorderLayout.NORTH);
    this.add(buttonPanel,BorderLayout.SOUTH);
  }