/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * RunsTestDialog.java
 *
 * Created on Jan 29, 2010, 3:30:46 PM
 */

package org.statcato.dialogs.stat.nonparametrics;

import org.statcato.*;
import org.statcato.spreadsheet.*;
import org.statcato.utils.HelperFunctions;
import org.statcato.statistics.inferential.nonparametrics.RunsTest;
import org.statcato.statistics.BasicStatistics;

import java.util.*;
import javax.swing.*;

/**
 * A dialog for Spearman's rank correlation.
 * Allows the user to specify the two variables and
 * significance level.  Computes Spearman's rank correlation coefficient,
 * critical value, and p-Value.  Displays results in the log window.
 *
 * @author  Margaret Yau
 * @version %I%, %G%
 * @see org.statcato.statistics.inferential.nonparametrics.RankCorrelation
 * @since 1.0
 */
public class RunsTestDialog extends StatcatoDialog {

    /** Creates new form RunsTestDialog */
    public RunsTestDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();

        app = (Statcato)parent;
        ParentSpreadsheet = app.getSpreadsheet();

        customInitComponents();

        setHelpFile("stat-nonparam-runs-test");
        name = "Runs Test";
        description = "For performing the runs test for randomness.";
        helpStrings.add("Provide the matched pairs in " +
                "two separate columns and add the series of two variables to " +
                "the list of variable series.");
        helpStrings.add("Provide the significance level.");
    }

    private void customInitComponents() {
        ParentSpreadsheet.populateComboBox(ColComboBox);
        ButtonGroup group1 = new ButtonGroup();
        group1.add(ColRadioButton);
        group1.add(SummaryRadioButton);
        ButtonGroup group2 = new ButtonGroup();
        group2.add(CatRadioButton);
        group2.add(NumRadioButton);
        ButtonGroup group3 = new ButtonGroup();
        group3.add(MeanRadioButton);
        group3.add(SepRadioButton);
    }

     /**
     * Updates elements on the dialog so that they have the most
     * current values.  Called by {@link #setVisible} to make
     * sure the dialog displays current values when made visible again.
     *
     * @see #setVisible(boolean)
     */
    @Override
    public void updateElements() {
        updateComboBox(ColComboBox);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        n2TextField = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        ColRadioButton = new javax.swing.JRadioButton();
        ColComboBox = new javax.swing.JComboBox();
        SummaryRadioButton = new javax.swing.JRadioButton();
        n1TextField = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        runsTextField = new javax.swing.JTextField();
        OKButton = new javax.swing.JButton();
        CancelButton = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jLabel9 = new javax.swing.JLabel();
        SigTextField = new javax.swing.JTextField();
        OptionsPanel = new javax.swing.JPanel();
        CatRadioButton = new javax.swing.JRadioButton();
        NumRadioButton = new javax.swing.JRadioButton();
        MeanRadioButton = new javax.swing.JRadioButton();
        SepRadioButton = new javax.swing.JRadioButton();
        SepTextField = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Runs Test");

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Inputs"));

        n2TextField.setEnabled(false);

        jLabel5.setText("Number of category 1:");

        jLabel1.setText("Column:");

        ColRadioButton.setSelected(true);
        ColRadioButton.setText("Samples in one column");
        ColRadioButton.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                ColRadioButtonStateChanged(evt);
            }
        });

        SummaryRadioButton.setText("Summarized sample data");
        SummaryRadioButton.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                SummaryRadioButtonStateChanged(evt);
            }
        });

        n1TextField.setEnabled(false);

        jLabel6.setText("Number of category 2:");

        jLabel7.setText("Number of runs:");

        runsTextField.setEnabled(false);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(ColRadioButton)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(21, 21, 21)
                        .addComponent(jLabel1)
                        .addGap(5, 5, 5)
                        .addComponent(ColComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(SummaryRadioButton)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(21, 21, 21)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(jLabel5)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(n1TextField))
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel6)
                                    .addComponent(jLabel7))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(runsTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(n2TextField, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))))))
                .addContainerGap(20, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ColRadioButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(ColComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(SummaryRadioButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(n1TextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(n2TextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(runsTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        OKButton.setText("OK");
        OKButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                OKButtonActionPerformed(evt);
            }
        });

        CancelButton.setText("Cancel");
        CancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CancelButtonActionPerformed(evt);
            }
        });

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Significance"));

        jLabel9.setText("Significance level:");

        SigTextField.setText("0.05");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel9)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(SigTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(51, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(SigTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        OptionsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Data Options"));

        CatRadioButton.setSelected(true);
        CatRadioButton.setText("Categorical");
        CatRadioButton.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                CatRadioButtonStateChanged(evt);
            }
        });

        NumRadioButton.setText("Numerical");
        NumRadioButton.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                NumRadioButtonStateChanged(evt);
            }
        });

        MeanRadioButton.setSelected(true);
        MeanRadioButton.setText("Above and below mean");
        MeanRadioButton.setEnabled(false);
        MeanRadioButton.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                MeanRadioButtonStateChanged(evt);
            }
        });

        SepRadioButton.setText("Above and below:");
        SepRadioButton.setEnabled(false);
        SepRadioButton.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                SepRadioButtonStateChanged(evt);
            }
        });

        SepTextField.setEnabled(false);

        javax.swing.GroupLayout OptionsPanelLayout = new javax.swing.GroupLayout(OptionsPanel);
        OptionsPanel.setLayout(OptionsPanelLayout);
        OptionsPanelLayout.setHorizontalGroup(
            OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(OptionsPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(CatRadioButton)
                    .addComponent(NumRadioButton)
                    .addGroup(OptionsPanelLayout.createSequentialGroup()
                        .addGap(21, 21, 21)
                        .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(OptionsPanelLayout.createSequentialGroup()
                                .addComponent(SepRadioButton)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(SepTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(MeanRadioButton))))
                .addContainerGap(22, Short.MAX_VALUE))
        );
        OptionsPanelLayout.setVerticalGroup(
            OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(OptionsPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(CatRadioButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(NumRadioButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(MeanRadioButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(SepRadioButton)
                    .addComponent(SepTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(13, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(OKButton))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(OptionsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(CancelButton))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {CancelButton, OKButton});

        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(3, 3, 3)
                        .addComponent(OptionsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(CancelButton)
                    .addComponent(OKButton))
                .addGap(26, 26, 26))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void ColRadioButtonStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_ColRadioButtonStateChanged
        if (ColRadioButton.isSelected()) {
            ColComboBox.setEnabled(true);
            OptionsPanel.setVisible(true);
        } else {
            ColComboBox.setEnabled(false);
            OptionsPanel.setVisible(false);
        }
}//GEN-LAST:event_ColRadioButtonStateChanged

    private void SummaryRadioButtonStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_SummaryRadioButtonStateChanged
        if (SummaryRadioButton.isSelected()) {
            n1TextField.setEnabled(true);
            n2TextField.setEnabled(true);
            runsTextField.setEnabled(true);
            OptionsPanel.setVisible(false);
        } else {
            n1TextField.setEnabled(false);
            n2TextField.setEnabled(false);
            runsTextField.setEnabled(false);
            OptionsPanel.setVisible(true);
        }
}//GEN-LAST:event_SummaryRadioButtonStateChanged

    private void OKButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OKButtonActionPerformed
        app.compoundEdit = new DialogEdit("runs test");

        String heading = "Runs Test:";
        String text = "";
        double significance;

        // get significance level from dialog
        try {
            significance = Double.parseDouble(SigTextField.getText());
        } catch (NumberFormatException e) {
            app.showErrorDialog("Enter a number between 0 and 1 for the significance level.");
            return;
        }
        if (significance <= 0 || significance >= 1) {
            app.showErrorDialog("Enter a number between 0 and 1 for the significance level.");
            return;
        }
        heading += "  Significance level = " + significance;

        if (ColRadioButton.isSelected()) {
            // a column of data is provided
            String columnLabel = ColComboBox.getSelectedItem().toString();
            text += "Data in column " + columnLabel + "<br>";

            if (columnLabel.equals("")) { // no labels column
                app.showErrorDialog("Select the column containing data.");
                return;
            }
            int column = ParentSpreadsheet.parseColumnNumber(columnLabel);
            Vector<Cell> ColVector = 
                    HelperFunctions.removeNullCells(ParentSpreadsheet.getColumn(column));

            if (CatRadioButton.isSelected()) {
                // categorical data
                try {
                    Object Values[] =
                        HelperFunctions.splitValuesVector(ColVector);
                    String cat1 = (String)Values[0];
                    String cat2 = (String)Values[2];
                    RunsTest runsTest =
                            new RunsTest(ColVector, cat1, cat2, significance);
                    text += "Categorical data: " + cat1 + ", " + cat2 + "<br>";
                    text += runsTest;
                }
                catch (Exception e) {
                    app.showErrorDialog("Only data of two categories are allowed.");
                    return;
                }
            }
            else {
                // numerical data
                 Vector<Double> XColumnVector =
                    HelperFunctions.ConvertInputVectorToDoubles(ColVector);
                 if (XColumnVector == null) {
                     app.showErrorDialog("Invalid input column " + columnLabel +
                             ": all data must be numbers.");
                     return;
                 }

                 XColumnVector = HelperFunctions.removeNullValues(XColumnVector);
                 if (XColumnVector.size() == 0) {
                     app.showErrorDialog("Invalid input column " + columnLabel +
                             ": empty column.");
                 }

                if (MeanRadioButton.isSelected()) {
                    // above or below mean
                    double mean = BasicStatistics.mean(XColumnVector);
                    RunsTest runsTest = new RunsTest(XColumnVector, mean,
                            significance);
                    text += "Numerical data, above and below " +
                            HelperFunctions.formatFloat(mean, 4) + "<br>";
                    text += runsTest;
                }
                else {
                    // above or below a specified number
                    try {
                        double separator = Double.parseDouble(SepTextField.getText());
                        RunsTest runsTest = new RunsTest(XColumnVector,
                                separator, significance);
                        text += "Numerical data, above and below " +
                            HelperFunctions.formatFloat(separator, 4) + "<br>";
                        text += runsTest;
                    }
                    catch (Exception e) {
                        app.showErrorDialog("Enter a valid number of the above " +
                                "and below separating value.");
                        return;
                    }

                }
            }
            
        }
        else {
            int n1, n2, runs;
            // summary data is provided
             try {
                n1 = Integer.parseInt(n1TextField.getText());
                n2 = Integer.parseInt(n2TextField.getText());
                runs = Integer.parseInt(runsTextField.getText());
                RunsTest runsTest = new RunsTest(n1, n2, runs, significance);
                text += runsTest;
            } catch (NumberFormatException e) {
                app.showErrorDialog("Enter integers for the number of " +
                        "category 1, number of category 2, and number of runs.");
                return;
            }
        }

        app.addLogParagraph(heading, text);

        app.compoundEdit.end();
        app.addCompoundEdit(app.compoundEdit);

        setVisible(false);
}//GEN-LAST:event_OKButtonActionPerformed

    private void CancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelButtonActionPerformed
        setVisible(false);
}//GEN-LAST:event_CancelButtonActionPerformed

    private void CatRadioButtonStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_CatRadioButtonStateChanged
        if (CatRadioButton.isSelected()) {
            MeanRadioButton.setEnabled(false);
            SepRadioButton.setEnabled(false);
            SepTextField.setEnabled(false);
        }
        else {
            MeanRadioButton.setEnabled(true);
            SepRadioButton.setEnabled(true);
            if (SepRadioButton.isSelected())
                SepTextField.setEnabled(true);
            else
                SepTextField.setEnabled(false);
        }
    }//GEN-LAST:event_CatRadioButtonStateChanged

    private void NumRadioButtonStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_NumRadioButtonStateChanged
        if (CatRadioButton.isSelected()) {
            MeanRadioButton.setEnabled(false);
            SepRadioButton.setEnabled(false);
            SepTextField.setEnabled(false);
        }
        else {
            MeanRadioButton.setEnabled(true);
            SepRadioButton.setEnabled(true);
            if (SepRadioButton.isSelected())
                SepTextField.setEnabled(true);
            else
                SepTextField.setEnabled(false);
        }
    }//GEN-LAST:event_NumRadioButtonStateChanged

    private void MeanRadioButtonStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_MeanRadioButtonStateChanged
        if (MeanRadioButton.isSelected()) {
            SepTextField.setEnabled(false);
        }
        else {
            SepTextField.setEnabled(true);
        }
    }//GEN-LAST:event_MeanRadioButtonStateChanged

    private void SepRadioButtonStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_SepRadioButtonStateChanged
        if (MeanRadioButton.isSelected()) {
            SepTextField.setEnabled(false);
        }
        else {
            SepTextField.setEnabled(true);
        }
    }//GEN-LAST:event_SepRadioButtonStateChanged

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton CancelButton;
    private javax.swing.JRadioButton CatRadioButton;
    private javax.swing.JComboBox ColComboBox;
    private javax.swing.JRadioButton ColRadioButton;
    private javax.swing.JRadioButton MeanRadioButton;
    private javax.swing.JRadioButton NumRadioButton;
    private javax.swing.JButton OKButton;
    private javax.swing.JPanel OptionsPanel;
    private javax.swing.JRadioButton SepRadioButton;
    private javax.swing.JTextField SepTextField;
    private javax.swing.JTextField SigTextField;
    private javax.swing.JRadioButton SummaryRadioButton;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JTextField n1TextField;
    private javax.swing.JTextField n2TextField;
    private javax.swing.JTextField runsTextField;
    // End of variables declaration//GEN-END:variables

}
