private void setUpIndexPanel(JPanel indexPanel)
  {
    JPanel topPanel = new JPanel();
    Box vertBox = Box.createVerticalBox();
    
     // create the image icons for the buttons
    Icon prevIcon = new ImageIcon(SoundExplorer.class.getResource("leftArrow.gif"), 
                                  "previous index");
    Icon nextIcon = new ImageIcon(SoundExplorer.class.getResource("rightArrow.gif"), 
                                  "next index");
    Icon firstIcon = new ImageIcon(SoundExplorer.class.getResource("endLeft.gif"), 
                                   "first index");
    Icon lastIcon = new ImageIcon(SoundExplorer.class.getResource("endRight.gif"), 
                                  "last index");
    
    // create the arrow buttons
    prevButton = new JButton(prevIcon);
    firstButton = new JButton(firstIcon);
    nextButton = new JButton(nextIcon);
    lastButton = new JButton(lastIcon);
    
    // set the tool tip text
    prevButton.setToolTipText("Click to view previous index (sample at previous pixel)");
    firstButton.setToolTipText("Click to view first index (sample at first pixel)");
    nextButton.setToolTipText("Click to view next index (sample at next pixel)");
    lastButton.setToolTipText("Click to view last index (sample at last pixel)");
    
    // set the preferred sizes of the buttons
    prevButton.setPreferredSize(new Dimension(prevIcon.getIconWidth() + 2,
                                              prevIcon.getIconHeight() + 2));
    firstButton.setPreferredSize(new Dimension(firstIcon.getIconWidth() + 2,
                                               firstIcon.getIconHeight() + 2));
    nextButton.setPreferredSize(new Dimension(nextIcon.getIconWidth() + 2,
                                              nextIcon.getIconHeight() + 2));
    lastButton.setPreferredSize(new Dimension(lastIcon.getIconWidth() + 2,
                                               lastIcon.getIconHeight() + 2));
                            
    
    // handle previous button press
    prevButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        currentPixelPosition--;
        if (currentPixelPosition < 0)
          currentPixelPosition = 0;
        updateIndexValues();
        checkScroll();
        soundFrame.getContentPane().repaint();
      }
    });
                                 
    // handle next button press
    nextButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        currentPixelPosition++;
        if (currentPixelPosition * framesPerPixel >= sound.getNumSamples())
          currentPixelPosition = (int) ((sound.getNumSamples() - 1) / framesPerPixel);
        updateIndexValues();
        checkScroll();
        soundFrame.getContentPane().repaint();
      }
    });
    
    // handle first button press
    firstButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        currentPixelPosition = 0;
        updateIndexValues();
        checkScroll();
        soundFrame.getContentPane().repaint();
      }
    });
                                 
    // handle last button press
    lastButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        currentPixelPosition = (int) ((sound.getNumSamples() - 1) / framesPerPixel);
        updateIndexValues();
        checkScroll();
        soundFrame.getContentPane().repaint();
      }
    });
    
    // create the index value textfield
    indexValue = new JTextField(Integer.toString(0),8);
    indexValue.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        
        // zoom in around user entered value
        handleZoomIn(Integer.parseInt(indexValue.getText()));
        
        // update the values for the pixel at the current index
        updateIndexValues();
      }
    });
    
    // create the left sample value and right sample value textfields
    leftSampleValue = new JTextField(8);
    leftSampleValue.setEditable(false);
    rightSampleValue = new JTextField(8);
    rightSampleValue.setEditable(false);
    
    // create the labels 
    indexLabel = new JLabel(currentIndexText);
    leftSampleLabel = new JLabel(leftSampleText);
    rightSampleLabel = new JLabel(rightSampleText);
    updateIndexValues();
                                 
    // add the buttons and label to the top panel
    topPanel.add(firstButton);
    topPanel.add(prevButton);
    topPanel.add(indexLabel);
    topPanel.add(indexValue);
    topPanel.add(leftSampleLabel);
    topPanel.add(leftSampleValue);
    if (inStereo) {
      topPanel.add(rightSampleLabel);
      topPanel.add(rightSampleValue);
    }
    topPanel.add(nextButton);
    topPanel.add(lastButton);
    
    // create bottom panel
    JPanel bottomPanel = new JPanel();
    bottomPanel.add(new JLabel("The number of samples between pixels: "));
    numSamplesPerPixelField = new JTextField(Integer.toString((int) framesPerPixel),8);
    numSamplesPerPixelField.setToolTipText("Click here to zoom in (decrease) or out (increase))");
    numSamplesPerPixelField.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        
        // zoom in around user entered value
        handleFramesPerPixel(Integer.parseInt(numSamplesPerPixelField.getText()));
        
        // update the values for the pixel at the current index
        updateIndexValues();
      }
    });
    bottomPanel.add(numSamplesPerPixelField);
    
    
    // add the top panel to the box
    vertBox.add(topPanel);
    vertBox.add(bottomPanel);
    
    // add the vertical box to the index panel
    indexPanel.add(vertBox);
                                                             
  }