/*
 * ConfigFrame_n.java
 *
 * Created on February 9, 2004, 1:00 PM
 */
package usda.weru.mcrew.gui;

import java.awt.event.ActionListener;
import java.awt.event.ItemListener;
import java.awt.event.WindowListener;

/**
 * This class builds the GUI for configuration options of the MCREW screen like
 * having the table view in calibrate mode, etc.
 * @author  manmohan
 */
public class ConfigFrame_n extends javax.swing.JFrame implements ActionListener, ItemListener, WindowListener {

    private static final long serialVersionUID = 1L;

    /**
     * Default constructor for the config frame GUI object.
     */
    public ConfigFrame_n() {
        initComponents();
    }

    /**
     * Single argument constructor for the config frame GUI object.
     * @param sTitle The title of the frame in which the config frame sits.
     */
    public ConfigFrame_n(java.lang.String sTitle) {
        this();
        setTitle(sTitle);
    }

    /** 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.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        JB_OK = new javax.swing.JButton();
        JB_cancel = new javax.swing.JButton();
        JCB_other = new javax.swing.JCheckBox();
        JCB_calibrate = new javax.swing.JCheckBox();

        setTitle("Calibrate");
        addWindowListener(this);
        getContentPane().setLayout(null);

        JB_OK.setText("OK");
        JB_OK.addActionListener(this);
        getContentPane().add(JB_OK);
        JB_OK.setBounds(40, 200, 80, 25);

        JB_cancel.setText("Cancel");
        JB_cancel.addActionListener(this);
        getContentPane().add(JB_cancel);
        JB_cancel.setBounds(130, 200, 80, 25);

        JCB_other.setSelected(true);
        JCB_other.setText("Other");
        JCB_other.addItemListener(this);
        getContentPane().add(JCB_other);
        JCB_other.setBounds(50, 65, 100, 30);

        JCB_calibrate.setSelected(true);
        JCB_calibrate.setText("Calibrate");
        JCB_calibrate.addItemListener(this);
        getContentPane().add(JCB_calibrate);
        JCB_calibrate.setBounds(50, 25, 100, 30);

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-250)/2, (screenSize.height-285)/2, 250, 285);
    }

    // Code for dispatching events from components to event handlers.

    public void actionPerformed(java.awt.event.ActionEvent evt) {
        if (evt.getSource() == JB_OK) {
            ConfigFrame_n.this.JB_OK_ActionPerformed(evt);
        }
        else if (evt.getSource() == JB_cancel) {
            ConfigFrame_n.this.JB_cancel_ActionPerformed(evt);
        }
    }

    public void itemStateChanged(java.awt.event.ItemEvent evt) {
        if (evt.getSource() == JCB_other) {
            ConfigFrame_n.this.JCB_other_ItemStateChanged(evt);
        }
        else if (evt.getSource() == JCB_calibrate) {
            ConfigFrame_n.this.JCB_calibrate_ItemStateChanged(evt);
        }
    }

    public void windowActivated(java.awt.event.WindowEvent evt) {
    }

    public void windowClosed(java.awt.event.WindowEvent evt) {
    }

    public void windowClosing(java.awt.event.WindowEvent evt) {
        if (evt.getSource() == ConfigFrame_n.this) {
            ConfigFrame_n.this.exitForm(evt);
        }
    }

    public void windowDeactivated(java.awt.event.WindowEvent evt) {
    }

    public void windowDeiconified(java.awt.event.WindowEvent evt) {
    }

    public void windowIconified(java.awt.event.WindowEvent evt) {
    }

    public void windowOpened(java.awt.event.WindowEvent evt) {
    }// </editor-fold>//GEN-END:initComponents

    private void JCB_other_ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_JCB_other_ItemStateChanged
}//GEN-LAST:event_JCB_other_ItemStateChanged

    private void JCB_calibrate_ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_JCB_calibrate_ItemStateChanged
}//GEN-LAST:event_JCB_calibrate_ItemStateChanged

    private void JB_cancel_ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_cancel_ActionPerformed
        JB_cancel_actionPerformed(evt);
    }//GEN-LAST:event_JB_cancel_ActionPerformed

    private void JB_OK_ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JB_OK_ActionPerformed
        JB_OK_actionPerformed(evt);
    }//GEN-LAST:event_JB_OK_ActionPerformed

    /** Exit the Application */
    private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
        this.dispose();
    }//GEN-LAST:event_exitForm

    /**  
     * This method is called when a cancel button on the config frame is pressed
     * and any modifications to the data on the screen need not be saved.
     * @param evt The event generated when the cancel button is pressed.
     */
    public void JB_cancel_actionPerformed(java.awt.event.ActionEvent evt) {
    }

    /**  
     * This method is called when an OK button on the config frame is pressed
     * and any modifications to the data on the screen need to be saved.
     * @param evt The event generated when the cancel button is pressed.
     */
    public void JB_OK_actionPerformed(java.awt.event.ActionEvent evt) {
    }

    /**
     * This method is used if this dialog is rum as an independent application.
     * @param args These are the command line arguments passed to the main method.
     */
    public static void main(String args[]) {
        new ConfigFrame_n().setVisible(true);
    }

    /**
     * This method notifies when the window or frame is resized and the components need to be
     * re-arranged so they are evenly spaced relative to each other.
     */
    @Override
    public void addNotify() {
        super.addNotify();
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    public javax.swing.JButton JB_OK;
    public javax.swing.JButton JB_cancel;
    public javax.swing.JCheckBox JCB_calibrate;
    public javax.swing.JCheckBox JCB_other;
    // End of variables declaration//GEN-END:variables

}
