code: private JComponent createControls()
      {
          JPanel controls = new JPanel(new FlowLayout(FlowLayout.RIGHT));
  
          final JCheckBox meanCheckBox = new JCheckBox("Show Mean and Standard Deviation", false);
          meanCheckBox.addItemListener(new ItemListener()
          {
              public void itemStateChanged(ItemEvent itemEvent)
              {
                  chart.setNotify(false);
                  CategoryPlot plot = (CategoryPlot) chart.getPlot();
                  if (itemEvent.getStateChange() == ItemEvent.SELECTED)
                  {
                      plot.setDataset(1, meanDataSet);
                      plot.setRenderer(1, meanRenderer);
                  }
                  else
                  {
                      plot.setDataset(1, null);
                      plot.setRenderer(1, null);
                  }
                  chart.setNotify(true);
              }
          });
          controls.add(meanCheckBox);
  
          return controls;
      }
docs: Creates the GUI controls for toggling graph display options.
  @return A component that can be added to the main panel.