/*
 * MapViewer_n.java
 * Created on February 14, 2005, 1:00 PM
 * Modified 10/24/05 10:30 AM -- Matthew Brubaker
 *  Included two new JLabels that will contain the State information
 */

package usda.weru.weps.gui;

/**
 * This is a GUI object for viewing the Map with location details for hte all the 
 * climate & wind generation stations acros the 50 US states categorized under each 
 * county within that state.
 * @author  wjr, Manmohan
 */
public class MapViewer_n extends javax.swing.JFrame {
    
    /**
    * Default constructor for the MapViewer Panel GUI object that helps the
    * user in locating the Wind/Climate stations across the nations on the US Map
    * by the use of a mouse click option.
    * It also initializes the components that go in the GUI with default settings.
    */
    public MapViewer_n() {
        initComponents();
    }
    
    /** 
     * 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() {

        BG_cursor = new javax.swing.ButtonGroup();
        JP_map = new javax.swing.JPanel();
        JP_tools = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        JL_lon = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        JL_lat = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        JL_county = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        JTA_stationInfo = new javax.swing.JTextArea();
        JCB_wind = new javax.swing.JCheckBox();
        JCB_cli = new javax.swing.JCheckBox();
        jLabel4 = new javax.swing.JLabel();
        JL_state = new javax.swing.JLabel();
        JP_buttons = new javax.swing.JPanel();
        JRB_select = new javax.swing.JRadioButton();
        JRB_center = new javax.swing.JRadioButton();
        JRB_zoomin = new javax.swing.JRadioButton();
        JRB_zoomout = new javax.swing.JRadioButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Map Viewer");
        setBackground(new java.awt.Color(255, 255, 255));
        setName("JF_mapViewer"); // NOI18N
        addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentResized(java.awt.event.ComponentEvent evt) {
                ComponentResized(evt);
            }
        });
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                exitForm(evt);
            }
        });
        addWindowFocusListener(new java.awt.event.WindowFocusListener() {
            public void windowGainedFocus(java.awt.event.WindowEvent evt) {
                windowGainedFocus_ActionPerformed(evt);
            }
            public void windowLostFocus(java.awt.event.WindowEvent evt) {
            }
        });
        getContentPane().setLayout(null);

        JP_map.setBackground(new java.awt.Color(255, 255, 255));
        JP_map.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        JP_map.setLayout(null);
        getContentPane().add(JP_map);
        JP_map.setBounds(120, 0, 370, 370);

        JP_tools.setBackground(new java.awt.Color(204, 255, 204));
        JP_tools.setLayout(null);

        jLabel1.setBackground(new java.awt.Color(255, 255, 255));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel1.setText("Longitude");
        JP_tools.add(jLabel1);
        jLabel1.setBounds(10, 5, 60, 14);

        JL_lon.setBackground(new java.awt.Color(255, 255, 255));
        JL_lon.setText("no long selected");
        JP_tools.add(JL_lon);
        JL_lon.setBounds(10, 25, 78, 14);

        jLabel5.setBackground(new java.awt.Color(255, 255, 255));
        jLabel5.setText("Latitude");
        JP_tools.add(jLabel5);
        jLabel5.setBounds(10, 45, 50, 14);

        JL_lat.setBackground(new java.awt.Color(255, 255, 255));
        JL_lat.setText("no long selected");
        JP_tools.add(JL_lat);
        JL_lat.setBounds(10, 65, 78, 14);

        jLabel2.setBackground(new java.awt.Color(255, 255, 255));
        jLabel2.setText("County");
        JP_tools.add(jLabel2);
        jLabel2.setBounds(10, 125, 50, 14);

        JL_county.setBackground(new java.awt.Color(255, 255, 255));
        JL_county.setText("no county selected");
        JP_tools.add(JL_county);
        JL_county.setBounds(10, 145, 91, 14);

        jScrollPane2.setPreferredSize(new java.awt.Dimension(100, 150));

        JTA_stationInfo.setFont(new java.awt.Font("Arial", 0, 10));
        jScrollPane2.setViewportView(JTA_stationInfo);

        JP_tools.add(jScrollPane2);
        jScrollPane2.setBounds(10, 180, 100, 120);

        JCB_wind.setBackground(new java.awt.Color(255, 255, 255));
        JCB_wind.setFont(new java.awt.Font("MS Sans Serif", 0, 10));
        JCB_wind.setSelected(true);
        JCB_wind.setText("Wind Stations");
        JCB_wind.setActionCommand("wind");
        JCB_wind.setOpaque(false);
        JCB_wind.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                JCB_windItemStateChanged(evt);
            }
        });
        JCB_wind.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JCB_windActionPerformed(evt);
            }
        });
        JP_tools.add(JCB_wind);
        JCB_wind.setBounds(0, 350, 91, 23);

        JCB_cli.setBackground(new java.awt.Color(255, 255, 255));
        JCB_cli.setFont(new java.awt.Font("MS Sans Serif", 0, 10));
        JCB_cli.setSelected(true);
        JCB_cli.setText("Climate Stations");
        JCB_cli.setActionCommand("cli");
        JCB_cli.setOpaque(false);
        JCB_cli.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                JCB_cliItemStateChanged(evt);
            }
        });
        JP_tools.add(JCB_cli);
        JCB_cli.setBounds(0, 320, 103, 23);

        jLabel4.setText("State");
        JP_tools.add(jLabel4);
        jLabel4.setBounds(10, 85, 95, 14);

        JL_state.setText("no state selected");
        JP_tools.add(JL_state);
        JL_state.setBounds(10, 105, 95, 14);

        getContentPane().add(JP_tools);
        JP_tools.setBounds(0, 0, 120, 370);

        JP_buttons.setBackground(new java.awt.Color(204, 204, 255));

        BG_cursor.add(JRB_select);
        JRB_select.setMnemonic('c');
        JRB_select.setSelected(true);
        JRB_select.setText("Select");
        JRB_select.setOpaque(false);
        JRB_select.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JRB_selectAP(evt);
            }
        });
        JP_buttons.add(JRB_select);

        BG_cursor.add(JRB_center);
        JRB_center.setMnemonic('c');
        JRB_center.setText("Center");
        JRB_center.setOpaque(false);
        JRB_center.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JRB_centerAP(evt);
            }
        });
        JP_buttons.add(JRB_center);

        BG_cursor.add(JRB_zoomin);
        JRB_zoomin.setMnemonic('I');
        JRB_zoomin.setText("Zoom In");
        JRB_zoomin.setOpaque(false);
        JRB_zoomin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JRB_zoominAP(evt);
            }
        });
        JP_buttons.add(JRB_zoomin);

        BG_cursor.add(JRB_zoomout);
        JRB_zoomout.setMnemonic('t');
        JRB_zoomout.setText("Zoom Out");
        JRB_zoomout.setOpaque(false);
        JRB_zoomout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                JRB_zoomoutAP(evt);
            }
        });
        JP_buttons.add(JRB_zoomout);

        getContentPane().add(JP_buttons);
        JP_buttons.setBounds(0, 370, 490, 30);

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-499)/2, (screenSize.height-434)/2, 499, 434);
    }// </editor-fold>//GEN-END:initComponents

    private void windowGainedFocus_ActionPerformed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_windowGainedFocus_ActionPerformed
        windowGainedFocus_actionPerformed(evt);
    }//GEN-LAST:event_windowGainedFocus_ActionPerformed

    private void JRB_zoomoutAP(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JRB_zoomoutAP
        RGB_actionPerformed(evt);
    }//GEN-LAST:event_JRB_zoomoutAP

    private void JRB_zoominAP(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JRB_zoominAP
        RGB_actionPerformed(evt);
    }//GEN-LAST:event_JRB_zoominAP

    private void JRB_centerAP(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JRB_centerAP
        RGB_actionPerformed(evt);
    }//GEN-LAST:event_JRB_centerAP

    private void JCB_windItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_JCB_windItemStateChanged
        winCli_ItemStateChanged(evt);
    }//GEN-LAST:event_JCB_windItemStateChanged

    private void JCB_cliItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_JCB_cliItemStateChanged
        winCli_ItemStateChanged(evt);
    }//GEN-LAST:event_JCB_cliItemStateChanged
    protected void winCli_ItemStateChanged(java.awt.event.ItemEvent evt) {
    }
    
    private void JCB_windActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JCB_windActionPerformed
        //TODO
    }//GEN-LAST:event_JCB_windActionPerformed

    protected void RGB_actionPerformed(java.awt.event.ActionEvent evt) {

    }

    private void ComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_ComponentResized
        componentResized(evt);
    }//GEN-LAST:event_ComponentResized
    
    /** Exit the Application */
    private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
        //System.exit(0);
		dispose();
    }//GEN-LAST:event_exitForm

    private void JRB_selectAP(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JRB_selectAP
        RGB_actionPerformed(evt);
}//GEN-LAST:event_JRB_selectAP
    
   /**
   * This method is used if this dialog is rum as an independent application. If executed,
   * makes the GUI visible.
   * @param args These are the command line arguments passed to the main method.
   */
    public static void main(String args[]) {
        new MapViewer_n().setVisible(true);
    }
    
    /**
     * This method adjust the components in the operation dialog so that the adjoining 
     * components are spaced uniformly w.r.t each other when a window or frame is 
     * resized.
     * @param evt The resize event that occurs on the window.
     */
    protected void componentResized(java.awt.event.ComponentEvent evt) {
    }
    
       
    protected void windowGainedFocus_actionPerformed(java.awt.event.WindowEvent evt) {
        // TODO add your handling code here:
        
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    protected javax.swing.ButtonGroup BG_cursor;
    protected javax.swing.JCheckBox JCB_cli;
    protected javax.swing.JCheckBox JCB_wind;
    protected javax.swing.JLabel JL_county;
    protected javax.swing.JLabel JL_lat;
    protected javax.swing.JLabel JL_lon;
    protected javax.swing.JLabel JL_state;
    protected javax.swing.JPanel JP_buttons;
    public javax.swing.JPanel JP_map;
    protected javax.swing.JPanel JP_tools;
    protected javax.swing.JRadioButton JRB_center;
    protected javax.swing.JRadioButton JRB_select;
    protected javax.swing.JRadioButton JRB_zoomin;
    protected javax.swing.JRadioButton JRB_zoomout;
    protected javax.swing.JTextArea JTA_stationInfo;
    protected javax.swing.JLabel jLabel1;
    protected javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel4;
    protected javax.swing.JLabel jLabel5;
    protected javax.swing.JScrollPane jScrollPane2;
    // End of variables declaration//GEN-END:variables
    
}
