JTuningAdvancedPanel(int extraXMargin, int extraYMargin) {
	    super(extraXMargin,extraYMargin);
	    setLayout(new FlowLayout());
	    jTuningNotePanel = new JPanel(new FlowLayout());
	    jTuningNotePanel.setBorder(advancedSettingsBorder);
	    jTuningNotePanel.add(new JLabel("Tuning Ref"));
	    // What note is used as the tuning reference
	    tuningNotes = new JComboBox<String>();
	    tuningNotes.setFont(dropdownFont);
	    tuningNotes.addFocusListener(blockKeysFocusListener);
	    for(int i=0; i<notes.length; i++) {
		tuningNotes.addItem(notes[i]);
	    }
	    tuningNotes.setSelectedItem("A");
	    
	    setMinMaxFreqs();

	    // What frequency is the tuning reference note set to?
	    tuningFreq = new JComboBox<String>();
	    tuningFreq.setFont(dropdownFont);
	    tuningFreq.setEditable(true);
	    // apparently JComboBoxes don't do focus listeners or input verifiers how I would expect.
	    // following code is a workaround
	    tuningFreq.getEditor().getEditorComponent().addFocusListener(blockKeysFocusListener);	  
	    tuningfrequency = 440;
	    // Make sure a valid value is entered
	    ((JTextField) tuningFreq.getEditor().getEditorComponent()).setInputVerifier(new InputVerifier(){
		    public boolean verify(JComponent comp) {
			Double tryfreq = parseFrequency(((JTextField)comp).getText());
			if( tryfreq < 0){
			    displayerror("Please enter a positive number for the frequency");
			    ((JTextField)comp).setText(Double.toString(tuningfrequency));
			    return(false);
			}
			if(( tryfreq < minfreq )||( tryfreq > maxfreq ) ){
			    displayerror("For the selected root note, the frequency must be between "+Double.toString(minfreq)+" Hz and "+Double.toString(maxfreq)+" Hz.  If you are setting the note in a different octave than I was expecting, you might try multiplying or dividing by 2 one or more times to see if you get a frequency in this range.");
			    ((JTextField)comp).setText(Double.toString(tuningfrequency));
			    return(false);
			}
			tuningfrequency = tryfreq;
			((JTextField)comp).setText(Double.toString(tuningfrequency));
			return(true);
		    }
		});
	    tuningFreq.addActionListener(new ActionListener(){
		    public void actionPerformed(ActionEvent e){
			// When changing the list of items in this combo box,
			// we disable it.  That way, when this actionlistener
			// is fired, we don't try to run updateValues
			// which would crash the system because at that moment
			// there is no selection.
			if(tuningFreq.isEnabled())
			    updateValues();
		    }
		});
	    
	    // list the standard A tunings
	    for(int i=0; i < Afreqs.length;i++){
		tuningFreq.addItem(Afreqs[i]);
	    }
	    tuningFreq.setSelectedItem(Integer.toString(440));

	    tuningNotes.addActionListener(new ActionListener(){
		    public void actionPerformed(ActionEvent e){
			String defaultfreq = new DecimalFormat("#.##").format(440.0*Math.pow(2.0,((double)(tuningNotes.getSelectedIndex()-9)/12.0)));
			//Double.toString(440.0*Math.pow(2.0,((double)(tuningNotes.getSelectedIndex()-9))/12.0));
			// If we attempt to access the frequency selectio while there are no items, we get a crash. 
			// So the action listener doesn't call the command to update midi settings if tuningFreq
			// is disabled.  That's why I disable it here.
			tuningFreq.setEnabled(false);
			tuningFreq.removeAllItems();
			// if A is the tuning note, list the standard A tuning schemes
			if(tuningNotes.getSelectedItem()=="A"){
			    for(int i=0; i < Afreqs.length; i++){
				tuningFreq.addItem(Afreqs[i]);
			    }
			    tuningFreq.setSelectedItem("440");
			}
			// if C is the tuning note, list "scientific" tuning, along with
			// standard "A440" tuning, but referenced to a C
			else if(tuningNotes.getSelectedItem() == "C"){
			    tuningFreq.addItem("Standard C:"+defaultfreq);
			    tuningFreq.addItem("\"Scientific\" C:256");
			    tuningFreq.setSelectedItem(defaultfreq);
			}
			// otherwise, list the standard frequency this note would have
			// if we tuned to A440 as a starting point.
			else{
			    tuningFreq.addItem("Standard "+tuningNotes.getSelectedItem()+":"+defaultfreq);
			    tuningFreq.setSelectedItem(defaultfreq);
			}
			tuningFreq.setEnabled(true);
			updateValues();
		    }
		});
	    jTuningNotePanel.add(tuningNotes);

	    jTuningNotePanel.add(tuningFreq);

	    //jTuningNotePanel.add(Box.createRigidArea(new Dimension(10,1)));

	    add(jTuningNotePanel);
	}